Skip to content

eXeC64/RegexLink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

RegexLink

About

This is a simple script I use to automatically create a bunch of symbolic links according to regular expression based rules.

It's intended use is for providing a clean web-server indexable directory structure for large collections of media files. Instead of the actual structure on disk with quirky filenames I can add a pattern to the pattern file and I get a nice directory of links with clean and consistent file names.

Usage

RegexLink.py [-q --quiet] [-h] [-v --version] [-p --patterns file] /path/to/search /output/path [input_pattern] [output_pattern]

Examples

RegexLink.py ~/Videos /var/www/media ".*/ts.S(\d\d)E(\d\d).mkv$" "TV Show/Season \1/Episode \2.mkv"

Edit the source to choose your input/output directories, then edit the patterns.txt file to define your patterns.

Alternatively you can specify arguments through a patterns file using the -p flag.

RegexLink.py ~/Videos /var/www/media -p patterns.txt

The format of patterns file is csv, like so:

".*/(\d+)/(.+)\.txt$","/txt/\2.\1.txt"

Column 0 represents the search pattern, column 1 is the replacement pattern, like sed -e "s/col0/col1/"

About

Regular expression based symbolic linker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages