Friday, September 19, 2008
Bash rename command - rename multiple files
Bash rename command is very useful to rename files in bulk.
e.g.
$ ls
a.cpp b.cpp c.cpp d.cpp
Now to rename all the *.cpp to *.cpp.bak using rename
$ rename 's/\.cpp$/.cpp.bak/' *.cpp
$ ls
a.cpp.bak b.cpp.bak c.cpp.bak d.cpp.bak
Now to rename all files matching "*.bak" to strip the extension,
$ rename 's/\.bak$//' *.bak
$ ls
a.cpp b.cpp c.cpp d.cpp
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
1 comment:
Its not bash command but rather a Perl script.
Post a Comment