Sunday, March 29, 2009

Batch renaming files on Linux

I had a bunch of PNG files which had both upper-case and lower-case extensions.

Trying to rename them in Windows was painful as I needed to rename it to a temporary extension, commit, then rename back and commit again.

I found a handy script to use in the command line of Linux, and since it supported case-sensitive filenames, all I had to do was rename and commit.
for file in *.PNG ; do svn mv $file `echo $file | sed 's/\(.*\.\)PNG/\1png/'` ; done
Worked like a charm!

No comments:

Post a Comment

Leave your thoughts ...

---
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'.

For more information about this Firefox bug, see here.