NAME
re
—
bulk rename with UNIX
philosophy
SYNOPSIS
re |
file [...] |
name |
[-x ] |
DESCRIPTION
re
and name
are
used in conjunction in order to bulk rename files.
re
writes a number of file names,
separated by newlines, to a temporary file and on standard out.
name
reads the original file names from
the temporary file and the new file names from standard in. It prints the
corresponding mv(1) commands on
standard out. If given the -x
flag, it executes them
as well.
The idiomatic way to use re
and
name
is to connect them with a pipe, with arbitrary
programs in-between.
EXAMPLES
The following invocation changes the file extension of all mp3 files:
$ re *.mp3 | sed 's/mp3$/m4a/' | name -x
The following invocation uses ep(1) to manually edit the file names in vi(1):
$ re * | ep | name
ep(1) is available for download at http://git.ankarstrom.se/xutil/.
AUTHORS
re
and name
are
written by John Ankarström <john (at) ankarstrom.se>.
BUGS
re
does not support file names containing
newlines and will exit with an error if provided with such file names.
name
uses hard-coded array sizes: at most,
one hundred 255-character file names can be processed. While overflows are
correctly handled, they are silently ignored. When processing very many or
very long file names, the use of the -x
flag is not
recommended.
The temporary file is placed at /var/tmp/re.$PPID, where $PPID is the process id of the parent shell. This means that one cannot simultaneously perform multiple bulk renames from the same shell process. Note that sub-shells retain the process id of their parent.