App-rename
view release on metacpan or search on metacpan
bin/rename.PL view on Meta::CPAN
=item B<--version>
Print version information on standard output then exit successfully.
=item B<-Y> I<prefix>, B<--basename-prefix=>I<prefix>
Use the B<simple> method to determine backup file names (see the B<-V>
I<method> or B<--version-control=>I<method> option), and prefix
I<prefix> to the basename of a file name when generating its backup file
name. For example, with B<-Y .del/> the simple backup file name for
B<a/b/foo> is B<a/b/.del/foo>.
=item B<-z> I<suffix>, B<-S> I<suffix>, B<--suffix=>I<suffix>
Use the B<simple> method to determine backup file names (see the B<-V>
I<method> or B<--version-control=>I<method> option), and append
I<suffix> to a file name when generating its backup file name.
=item B<--shell-completion=>I<shell>, B<--shellcompletion=>I<shell>
Generate shell code for parameter completion for either B<bash> or
B<zsh>.
=back
=head1 EXAMPLES
To rename all files matching *.bak to strip the extension, you might
say
rename 's/\.bak$//' *.bak
To translate uppercase names to lower, you'd use
rename 'y/A-Z/a-z/' *
More examples:
rename 's/\.flip$/.flop/' * # rename *.flip to *.flop
rename s/flip/flop/ * # rename *flip* to *flop*
rename 's/^s\.(.*)/$1.X/' * # switch sccs filenames around
rename 's/$/.orig/' */*.[ch] # add .orig to source files in */
rename 'y/A-Z/a-z/' * # lowercase all filenames in .
rename 'y/A-Z/a-z/ if -B' * # same, but just binaries!
or even
rename chop *~ # restore all ~ backup files
Use --git when working within a GIT repo:
# rename _-separated filenames to camel-case, using git mv
rename --git 's/([a-z]+)_/\u\L$1/g' *.c
# or just renaming all the *.yml files to *.yaml
rename -g 's/\.yml$/.yaml/ *.yml
With the --command parameter you can make rename do other interesing
stuff like:
# make thumbnails in PNG format of all JPEG file
rename 's/\.jpg/-thumb.png/' -C 'convert {} -resize 120x120 {}' *.jpg
=head1 ENVIRONMENT
Two environment variables are used, B<SIMPLE_BACKUP_SUFFIX> and
B<VERSION_CONTROL>. See L</OPTIONS>.
=head1 SEE ALSO
mv(1) and perl(1)
=head1 DIAGNOSTICS
If you give an invalid Perl expression you'll get a syntax error.
=head1 AUTHOR
Peder Stray <pederst@cpan.org>, original script from Larry Wall.
=head1 BUGS
Report any issues at L<https://github.com/pstray/rename/issues>.
=cut
!NO!SUBST!
print OUT "$code$doc";
( run in 2.306 seconds using v1.01-cache-2.11-cpan-a49fcb8fa48 )