Monday, September 10, 2012

How to batch rename files

for i in *; do j=`echo $i | cut -d . -f 1`; j=$j"_32.png"; mv $i $j; done Basically, this says "for every file in the folder, cut the filename on all dots and take the first result into variable 'j'. Then append '_32.png' onto the end of the variable. Finally move the original file to the new filename". (http://www.thingy-ma-jig.co.uk/comment/7855) example:

No comments:

Post a Comment