Bash Rename All Files in Dir
Posted by Alistair Macdonald
Mar 09 2011
Something I have never known how to do in Linux, is rename a directory full of files. (Crazy right?!) Fortunately for a noob like msyelf, Sam Bisbee does know how to do this, and showed me today. In the following example, I am renaming a directory of files with no file-extension, and moving them to the same location with “.png” appended.
for file in `ls` ; do mv $file $file.png; done
Simple. Useful. Documented.
Tagged in
Contact Us
We'd love to hear from you. Get in touch!