rename.td - rename multiple files by a Perl expression


NAME

rename.td - rename multiple files by a Perl expression


SYNOPSIS

rename.td [ -v[v] ] [ -n ] [ -f ] perlexprfiles ]

cat files.list | rename.td [ -v[v] ] [ -n ] [ -f ] perlexpr


DESCRIPTION

rename.td renames the files supplied according to the rule specified as the first argument. The perlexpr argument is a Perl expression which is expected to modify the $_ string in Perl for at least some of the filenames specified. If a given filename is not modified by the expression, it will not be renamed. If no filenames are given on the command line, filenames will be read via standard input.

For example, to rename all files matching *.bak to strip the extension, you might say

        rename.td 's/\.bak$//' *.bak

To translate uppercase names to lower, you'd use

        rename.td 'y/A-Z/a-z/' *


OPTIONS

-v, --verbose

Verbose: print names of files successfully renamed.

-vv

Verbose extra: print names of files of which name is not changed.

-n, --dry-run, --no-act

No Action: show what files would have been renamed, or skipped.

-f, --force

Force: overwrite existing files.

--mkdir

Create missing directories.


OUTPUT

Output Tab-delimited fields line-by-line. First line is the headers. Each subsequent line describes a file in this way:

  1. st field - status
    KEEP - no change in file name, shown in -vv mode
    SKIP - destination already exists, not in --force mode
    WOULD - would be attempted to rename, in --dry-run mode
    OK - successfully renamed
    ERR nnn - error happened during rename, error code is nnn
  2. nd field - old file name
  3. rd field - new file name


EXIT STATUS

Zero when all rename succeeded, otherwise the highest error number of all the failed renames, if any. See rename(2) for these error numbers.


ENVIRONMENT

No environment variables are used.


CREDITS

Larry Wall (author of the original)

Robin Barker


SEE ALSO

mv(1), perl(1), rename(2), file-rename(1p) (prename(1)), rename.ul (rename(1)), renamemanual(1)


DIAGNOSTICS

If you give an invalid Perl expression you'll get a syntax error.

 rename.td - rename multiple files by a Perl expression