NAME
pmv - rename files using Perl expressions
SYNOPSIS
pmv [options] expression [file ...]
Options:
--dry-run -n show, but do not do it
--link -l link instead of rename
--symlink -s symlink instead of rename
--reverse -r process in reverse order
--overwite -o overwrite existing files
--make-dirs -p create target dirs, if necessary
--verbose -v verbose information
--ident show identification
--help brief help message
DESCRIPTION
pmv will apply the given Perl expression to each of the file names. If the result is different from the original name, the file will be renamed, linked, or symlinked.
If the expression is any of uc
, lc
, of ucfirst
, pmv will DWIM. Note that these are pretty useless on file systems that are case insensitive.
pmv is a wrapper around File::PerlMove, which does most of the work.
OPTIONS
- --dry-run -n
-
Show the changes, but do not rename the files.
- --link -l
-
Link instead of rename.
- --symlink -s
-
Symlink instead of rename. Note that not all platforms support symlinking.
- --reverse -r
-
Process the files in reversed order.
- --overwrite -o
-
Overwrite existing files.
- --make-dirs -p
-
Create target directories if necessary.
- --verbose -v
-
More verbose information.
- --version
-
Print a version identification to standard output and exits.
- --help
-
Print a brief help message to standard output and exits.
- --ident
-
Prints a program identification. Processing continues.
- file
-
File name(s).
EXAMPLES
To change editor backup files back to Perl sources:
$ pmv -v 's/\.bak$/.pl/' *.bak
foo.bak => foo.pl
bar.bak => bar.pl
Lowcase file names:
$ pmv -v lc *JPG
DSC03345.JPG => dsc03345.jpg
DSC03346.JPG => dsc03346.jpg
DSC03347.JPG => dsc03347.jpg
Shift numbered examples to a new section:
$ pmv --verbose --reverse 's/^ex(\d)/"ex".($1+3)/ge' ex*
ex42.dat => ex72.dat
ex25.dat => ex55.dat
ex22.dat => ex52.dat
ex13.dat => ex43.dat
ex12.dat => ex42.dat
Note that these need to be processed in reversed order, to prevent ex12.dat => ex42.dat
botching with the exisitng ex42.dat
.
SEE ALSO
File::PerlMove, App::perlmv (and perlvm), File::Rename (and rename).
AUTHOR
Johan Vromans <jvromans@squirrel.nl>
COPYRIGHT
This programs is Copyright 2004,2010,2011,2017 Squirrel Consultancy.
This program is free software; you can redistribute it and/or modify it under the terms of the Perl Artistic License or the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.