Symlink Generator PowerShell and Bash

A little script I made to share my media between different servers. This is designed for Windows installs of the media servers (e.g. .exe) . This is not intended for Containers or Linux installs.

Introduction

This PowerShell script is a versatile tool designed to create symbolic links (symlinks) on your Windows system. A symbolic link is an advanced type of shortcut that makes a file or folder appear to exist in multiple locations without actually duplicating the data. This is particularly useful for media libraries where you might have original files in one location (e.g., recorded by a DVR) but want them to appear in another location for a media server (e.g., Jellyfin, Plex, Emby) to scan, without consuming double the disk space.

This script is intentionally generalized, using "Source" and "Destination" terminology, so it can be adapted to various data organization needs, not just specific media applications.

Features

  • Interactive Prompts: Guides you through the process by asking for necessary paths and choices.
  • Choice of Link Type: Allows you to create:
    • Directory Symlinks: Links to entire folders (e.g., for TV show seasons).
    • File Symlinks: Links to individual files (e.g., for movies).
    • Both: Process both types in one go.
  • Path Validation: Basic checks to ensure the source directories exist.
  • Prevents Duplicates: Skips creating symlinks if one already exists at the destination.
  • User-Friendly Output: Provides clear messages about what the script is doing.

Prerequisites

  • Operating System: Windows 10 or newer (PowerShell is pre-installed).
  • PowerShell: The script is written in PowerShell.
  • Administrator Privileges: Crucially, the script must be run with Administrator privileges to create symbolic links.

Bash version.

Introduction

This Bash script is a versatile tool designed to create symbolic links (symlinks) on your Linux system. A symbolic link is an advanced type of shortcut that makes a file or folder appear to exist in multiple locations without actually duplicating the data. This is particularly useful for media libraries where you might have original files in one location (e.g., recorded by a DVR) but want them to appear in another location for a media server (e.g., Jellyfin, Plex, Emby) to scan, without consuming double the disk space.

This script is intentionally generalized, using "Source" and "Destination" terminology, so it can be adapted to various data organization needs, not just specific media applications.

Features

  • Interactive Prompts: Guides you through the process by asking for necessary paths and choices.
  • Choice of Link Type: Allows you to create:
    • Directory Symlinks: Links to entire folders (e.g., for TV show seasons).
    • File Symlinks: Links to individual files (e.g., for movies).
    • Both: Process both types in one go.
  • Path Validation: Basic checks to ensure the source directories exist.
  • Prevents Duplicates: Skips creating symlinks if one already exists at the destination.
  • User-Friendly Output: Provides clear messages about what the script is doing.

Prerequisites

  • Operating System: Any Linux distribution with Bash installed.
  • Utilities: The script relies on standard Linux commands such as find, basename, mkdir, ln, and wc. These are typically pre-installed on most distributions.
  • Permissions: You need write access to the Destination directories where the symlinks will be created. No special root privileges are typically required for creating symlinks to locations you have write access to. If you are linking to system-wide paths, sudo might be necessary.
1 Like

It seems like a useful tool but without media renaming, it has no use for me. Jellyfin/Emby/Plex can be a bit picky about filenames and on top of that tend to match the shows wrong unless you put the show id or movie id in the folder.

It's just something I had sitting around I thought I'd share with anyone that might want it. Surprisingly, it worked fine with Jellyfin on my movies.

1 Like