Monday, September 26, 2011

Oneliner for renaming files

Say you have a series of files you want to rename like so: to to to

and so on...

Here's a useful oneliner for bash:

for x in `ls`; do echo $x | sed -e 's/\(.*\).zip/\'| xargs -t mv $x ; done

That should to it. Of course, there are other ways of doing it, but this way is fairly simple.