Just discovered the rename utility under Linux
Warning: There appears to be two ‘rename’ utilities one under Debian 6.0.7 works as below and is a Perl utility. The other, which I found on Fedora 19 is part of util-linux, and doesn’t work the same way (i.e. it’s a lot dumber).
Work-a-round copy /usr/bin/prename from your Debian system to /usr/bin on your Fedora System and run prename instead of rename.
rename Usage: rename [-v] [-n] [-f] perlexpr [filenames]
[email protected]:~$ mkdir rename_test [email protected]:~$ cd rename_test/ # create some test files [email protected]:~/rename_test$ touch file1.txt [email protected]:~/rename_test$ touch file2.txt [email protected]:~/rename_test$ touch file3.pdf [email protected]:~/rename_test$ touch file4.ogg [email protected]:~/rename_test$ ls file1.txt file2.txt file3.pdf file4.ogg [email protected]:~/rename_test$ ren rename rename.ul renice [email protected]:~/rename_test$ rename Usage: rename [-v] [-n] [-f] perlexpr [filenames] [email protected]:~/rename_test$ rename 's/file/new_prefix/g' * [email protected]:~/rename_test$ ls new_prefix1.txt new_prefix2.txt new_prefix3.pdf new_prefix4.ogg
0 Comments