Custom Command Examples
Rename the selected items by adding .bak to the end of each name.
The filename "This Is An Example.txt" would be renamed to "this is an example.txt.bak"
{ |
Use the rename command to convert the selected item names from mixed case to lowercase.
The filename "This Is An Example.txt" would be renamed to "this is an example.txt"
{ RNFR %f RNTO $lowercase(%f) } |
Lets say there are bunch of files and the first part of the name is "RW1F-K5963170-" but it they all need to be renamed to start with "K5963170-RW1F-", again using the rename command but this time along with the $replace command.
The filename "RW1F-K5963170-93803" would be renamed to "K5963170-RW1F-93803"
{ RNFR %f RNTO $replace("%f","RW1F-K5963170-","K5963170-RW1F-") } |
Send a site message.
The user will be prompted to enter the message.
SITE MSG %d["Please enter a message"] |
With the active side select all directories and then add them to the queue.
/selectall -d /queue selected |
With the active side rename all selected items using /ren and replace any spaces " " within the filename with an underscore "_"
The filename "this is an example.txt" would be renamed to "this_is_an_example.txt"
/ren "%f" "$replace("%f", " ", "_") |
Select all files containing *.css and *.js using wildcard matching.
/select -f *.css /andselect -f *.js |
With the active side rename all selected items using /ren and prefix each file with the current year and month.
The filename "this is an example.txt" would be renamed to "2014.04-this_is_an_example.txt"
/ren "%f" "%({YYYY}.{MM})-%f" |
Now lets use the $replacerx() token modifier to remove the year.month prefix that we added to the file in the above example.
The filename "2014.04-this_is_an_example.txt" would be renamed to "this is an example.txt"
/ren "%f" $replacerx("%f", "(\d+).(\d+)-(.*)", "\3") |