This guide provides instructions and examples to help you get started with file/folder renaming using PFrank.
When you first start PFrank, there are 2 basic things you can set up before you start
creating your renaming sequence. The first is the Current Folder and the second is the
Name Filter.
If you are unfamiliar with PFrank then it is highly recommended to create a test folder
with copies of some of the names you want to change. Use the test folder as your current folder.
Then follow the strategies outlined
below to experiment on the names. Even if you are comfortable with your renaming skills you
still might want to make a backup of all the original names in case something goes wrong.
Some example regular expressions are:
Regular expressions are more complicated than wildcards but they provide a much richer set of
pattern matching features. More details on wildcards can be found in the wildcard chapter of the PFrank built-in Help.
More details on regular expressions
can be found in the regex chapter of the PFrank built-in Help or at reference links listed at the PFrank web site
here.
Only names that completely match the filter will be selected. Partial matches will
not result in a selection. e.g.
a wildcard pattern set to '.mp3' will not match mymusic.mp3 but a wildcard pattern set to '*.mp3' will match it.
PFrank provides many ways to rename file/folder names. You can use the Insert buttons to either insert pre-defined patterns and
then modify them or you can insert specialized commands.
Most renaming can be done using regular expression (regex) search patterns
to match parts of or all of names and using regex replace patterns to substitute characters for the matched parts.
The search and replace patterns are entered into the rows of the custom renaming list. Just double clock on a row to
activate the editor and start typing.
Unlike the search pattern used in the name filter in which the entire name has to be matched, the
search pattern for name replacement only needs to match parts of the names. Each match in the name will be replaced. There
is a way to limit the number of matches using special flags; this is detailed in the
regex flags chapter of the PFrank built-in Help.
Sometimes the desired replacement can be done with 1 search/replace pattern. But more often you will require multiple
rows. Just remember that the patterns are processed from first row to last. The output name of a row is used
as the input to the next row (see Creating a Command Sequence)
To test your pattern sequence use the sample previewer. Just drag a sample name into the text field and watch how it
changes as you adjust your patterns. To assist in debugging you can disable any row of the pattern using the checkboxes or you
can add an exit command into the middle of
the rows to disable the trailing patterns.
Right clicking on the custom renaming list will give you a popup menu with lots of options for manipulating the
rows.
When you think your patterns/commands are ready, press the scan button. A preview window will pop up.
Be sure to check all the rows of the preview to ensure the names are as you expect. You can manually
edit any text in the new name column. If you don't like what you see, go back and adjust the custom renaming list,
rescan, inspect, etc.
When everything looks perfect, press the rename button to commit the changes. If after checking the folder,
something did go wrong, there is one level of undo available.
Right clicking on the preview list will give you a popup menu with lots of options for manipulating the
list.
IMPORTANT: The example sequences below surround the search/replace patterns in single quotes. Do not
enter the single quotes into the search/replace rows; they are only used in this web page for highlighting.
Some example search replace patterns for text or string substitutions are:
Text removal is simply another form of string substitution but instead of replacing the search string with something, you
replace it with nothing. This is done by leaving the replace pattern empty. Some example
search replace patterns for number or text removal are:
To add text you have to specify search strings as groups. Then in the replace pattern you reference the groups. Groups
are formed by surrounding them with parentheses in the search pattern. e.g. The first set of parentheses is group 1 and is
referenced by '\1'. A second group of parentheses would represent group 2 and is referenced by '\2'.
Some example search replace patterns for adding text are:
Renaming with Meta-Data is taking data obtained from within a file and using it to rename the file.
For example if you have mp3 files you could rename the files by incorporating things
like the artist name, song title, album name, etc into the name. Another example is
if you have image files you can
rename them according to the date/time, size or other information stored within the file.
If you want to insert music (e.g. mp3) or other meta-data into a filename, you have to go to the
options window (from the main window, pull down the View tab from the top menu, and select 'Options...'.
The options window will pop up. The left side of the window has a tree listing all the option
categories. The right side lists the configurable options pertainng to the selected
category.
For music files, select 'Music Information Insertion'. You'll see the insertion options
come up on the right-hand side of the
window. Use the 'custom format creator' to create the meta-data sequence to insert.
e.g. %Artist% - %Title%
The above will choose the artist name and title (separated by a dash) for insertion. You've
now selected what to insert whenever
you choose to insert music meta-data. You can set up similar configurations for
other types of meta-data. Plus there
are many more options which you can also configure for each type of meta-data.
Now you have to choose which meta-data to insert and where.
Go back to the main window and pull down the pre-defined renaming list. You should see
options to insert different types of information 'before' or 'after' and can
combine that with 'all or prefix or extension' to
insert the data within different parts of the name.
Once you have chosen the insertion command, press the
'insert in list' button to insert the command into the custom renaming list.
Below are some examples of search/replace rows for insertion of meta-data:
Setup
Current Folder
The current folder determines where your files/subfolders will be renamed from.
You can use the browse button to choose the folder, you can enter the full path
manually into the text field, or the simplest way is to just drag the folder
into the text field.
Name Filter
The name filters are patterns used to determine what types of names to include or exclude.
The patterns can be configured with regular expressions or wildcards depending on the pattern option
configured using the options panel. Both regular expressions and wildcards are well defined
formats (with some variations). The default format for name filters is wildcards.
Some example wildcard expressions are:
There are other many other filter options available.
Strategy
An undo file is also automatically generated which you can import so that you can undo your last change
anytime (even after restarting PFrank).
Or you can automatically generate an undo file for every renaming operation so it would be possible to undo a
series of renaming operations.
It is advisable to try the undo feature beforehand in case you run into any problems. ie. during a test run create
an undo file, perform the renaming, exit PFrank, restart PFrank,
import the undo file, carry out the
renaming to restore the original names, and then verify with an explorer window that the original names are back.
If you want
to test the samples you can copy the Row/Search/Replace lines to the Windows clipboard (block select with the mouse and
press Ctl-C), then
select the PFrank main window with the mouse and press Ctl-F2. That will insert the search replace lines at the top of the
custom renaming list!
String Substitution
Row: 1
Search: 'soccer'
Replace: 'football'
This will replace the name 'soccer match.avi' with 'football match.avi' or replace 'soccer soccer match.avi' with
football football match.avi'
Row: 1
Search: 'e'
Replace: 'o'
This will replace the name 'feetball.jpg' with 'football.jpg' or replace 'hello there.jpg' with
hollo thoro.jpg'
Be careful with meta characters!
For example, the following will lead to trouble:
This will NOT remove all the '.'s that follow 'g'.
Row: 1
Search: 'g.'
Replace: 'g'
'.' is similar to a wildcard. This renaming will instead remove the character that appears after
any 'g'. The proper way to remove the '.' is to first escape it either by preceeding it with a backslash as in '\.'
or enclosing it in square brackets as in '[.]'. Check the examples below.
Row: 1
Search: 'g\.'
Replace: 'g'
or
Row: 1
Search: 'g[.]'
Replace: 'g'
The above examples will replace the name 'racing.1.doc' with 'racing.doc' or replace 'programming.x.doc' with
programming.doc'
Number or Text Removal
Row: 1
Search: '1'
Replace:
This removes all 1's in the name. It will the replace the name 'soccer1.avi' with 'soccer.avi' or replace '1soccer111.avi' with
soccer.avi'
Row: 1
Search: '12'
Replace:
This will replace the name '121football.jpg' with '1football.jpg' or replace '1212hello12 there.jpg' with
hello there.jpg'
Row: 1
Search: '^The '
Replace:
This command is used to delete 'The ' from the start of names. In other words replace 'The ' with nothing.
This will replace the name 'The Football And The Baseball.jpg' with 'Football And The Baseball.jpg' or replace 'The School.jpg' with
School.jpg'
Row: 1
Search: 'o'
Replace:
This command is used to delete all 'o's from names. In other words replace 'e' with nothing.
This will replace the name 'Those Footballs.jpg' with 'Thse Ftballs.jpg' or replace 'The School.jpg' with
Schl.jpg'
Add Text
Row: 1
Search: '(.*)'
Replace: 'The \1'
This puts the entire name into a group (called group 1) and then adds 'The ' to the group. It will the
replace the name 'soccer.avi' with 'The soccer.avi' or replace 'football.avi' with
The football.avi'
Row: 1
Search: '(.*)'
Replace: 'ABCD\1'
This puts the entire name into a group (called group 1) and then adds 'ABCD' to the group. It will the
replace the name 'soccer.avi' with 'ABCDsoccer.avi' or replace 'football.avi' with
ABCDfootball.avi'
Row: 1
Search: '(?E)(.*)'
Replace: '\1 match'
This puts the entire name into a group (called group 1) and then adds ' match' after the group. The extension is
excluded from the search by the (?E) flag. More information on flags is detailed in the
regex flags chapter of the PFrank built-in Help. The search/replace pattern will
replace the name 'soccer.avi' with 'soccer match.avi' or replace 'football.avi' with
The football match.avi'
Inserting Meta-Data
Row: 1
Search:
Replace: '*Insert Music Information after*Prefix*'
This will insert the data as configured on the 'Music information Insertion' options panel into the filename.
The data will be inserted after
the prefix.
Row: 1
Search:
Replace: '*Insert Video Information before*Prefix*'
This will insert the data as configured on the 'Video information Insertion' options panel into the filename.
The data will be inserted before
the prefix.