The transformation operations are listed below, and are specified as short flags. Each flag performs a simple transformation. Adding additional flags creates a chaining of transformations, allowing the building of complex renames very quickly and easily. Flags perform the transformations in order they are specified, so this allows maximum control over when a transformation should occur.
As you add each transformation flag to the New name field, the Preview window will show you how a flag affects the file name.
-c case; follow with any of ulULtT (u=upper or l=lower first, U or L all, t=titlecase, or T=titlecase strict)
-d date append/prepend; format: -d/outspec/ or -d/inspec/outspec/ (-D prepends), *spec is a strftime template;
default outspec: -d: ' %d-%m-%Y', -D: '%Y-%m-%d '; inspec is pulled from filename between %% and %% (use a transform to insert them first)
-dd date guessing; format -dd or -dd/outspec/, *outspec uses printf formats in Date::Manip::Date
-e exclude files matching pattern; format: -e/RE/ use -E to ignore suffix
-f files or folders only: f=files-only, F=folders-only
-h html to ascii
-k kill text after (-k) or before (-K) specified string, inclusively (default) or exclusively: -k/string/[ei] -K=before optional: e=exclude, i=ignore case
-r replace; format: -r/oldstr/newstr/gie optional: g=global, i=ignore case, e=evaluate newstr as perl code
-rr replace range; format -rr/<range>/newstr/, rr=front, RR=rear; replace range of chars with newstr, <range> is either m or m-n and m <= n
-R reverse; format -R/oldsep/newsep/ reverse words using oldsep string replaced w/newsep string; empty oldsep reverses characters; empty newsep uses oldsep
-s suffix change, format: -s[lun] lowercase (default), uppercase, none
-S sort; format -S/oldsep/newsep/r sort words using oldsep string replaced w/newsep string; empty oldsep reverses characters; empty newsep uses oldsep; optional: r=reverse sort
-t transliteration; format: -t/srchlist/tolist/cds optional: c=compliment srch list, d=delete found but unreplaced, s=squash dups
-u uri unescape
-U Unicode to ASCII
-w whitespace spans to single space
-x trim characters; format -x[[=]n], x=front, X=rear; optional: n=number of chars (defaults to 1); '=' means leave n chars
-z zero pad number; format: -zn, where n is final number of 0-padded digits
-# number; increase #'s for padding or more digits; flags [r^] r=random, ^=numbers in front
-/ regular expression substitution; format: -/RE/replacement/gie optional: g=global, i=ignore case, e=eval expression
-^ append text at beginning; format: -^/text/
-$ append text at end; format: -$/text/
-+ add 1 (or n) to final numeric sequence; format: -+n optional n may be negative
As an example, in the following transformation:
Code: Select all
-u -h -s -b -a/El/ -cu -r/-/_/g -w
the -u flag replaces URI escapements (%20, etc.) with standard characters, -h replaces html entities, -s then lowercases the file suffix, -b then removes any bracketed content including the brackets, -a moves articles to the end including the user-defined "El" article, -cu uppercase the first word of the filename, -r replaces dashes with underbars globably (g flag), and -w finally cleans excessive whitespace.
I'll add more functions as people request them.
The script requires ActivePerl. Use version 22.214.171.1241 (not 126.96.36.1994). It is free, safe, easy, and non-invasive to install. Get the 32-bit or 64-bit installer as appropriate for your version of Windows:
Why did I use Perl? It is an exceptionally fast, rich, power scripting language that was designed to tasks such as this. Most transformations are a couple of lines of code - adding new functionality is very easy, so feel free to ask.
Note: Version 1.11 requires a module update in ActivePerl. After installing ActivePerl, open a Windows command shell, and enter the command:
Code: Select all
ppm install date-manip
and hit Enter. When the update is complete, you can exit out of the command shell. If you already have the date-manip module installed, use:
Code: Select all
ppm update date-manip
To install the Dynamic Renamer rename script, download the latest zip file below, unzip it, and then open Directory Opus' Rename dialog, and use its File > Import menu item, and select the Dynamic Renamer .orp file.
Comments welcome, assistance provided.