Bulk File Copy and Rename (renameutils)

Sometimes you need to copy or rename a bunch of files, either following some pattern or arbitrarily.

Mac OS finder (and certainly some Linux file managers) offers support for bulk rename. But when you want do to this on the console instead, using your favorite text editor, you can also use renameutils consisting of qcp (quick copy), qmv (quick move), icp and imv (the interactive versions).

Those tools work similar to cp and mv, including the support for wildcards, but allow you to preview and modify the operation before it is executed.

export EDITOR=mate -w    # use TextMate for editing, or your favorite editor
qmv *

This opens up a temporary file looking something like this:

DSC_2169.NEF				DSC_2169.NEF
DSC_2170.NEF				DSC_2170.NEF
DSC_2171.NEF				DSC_2171.NEF
DSC_2172.NEF				DSC_2172.NEF
DSC_2173.NEF				DSC_2173.NEF
DSC_2174.NEF				DSC_2174.NEF
DSC_2175.NEF				DSC_2175.NEF
DSC_2176.NEF				DSC_2176.NEF
DSC_2177.NEF				DSC_2177.NEF
DSC_2178.NEF				DSC_2178.NEF
DSC_2179.NEF				DSC_2179.NEF

The left column defines the current names, the right column the new names. If you remove files from the list, they will not be touched. By default the left and right column are identical and nothing will be renamed.

Now you can use your text editor to do column, multi-cursor, regular expression and whatever else you can imagine to defined file renames.

The interactive versions require only the source file name (only one) and allow you to modify the name directly in the terminal without having to copy or autocomplete it.