Created
February 2, 2012 18:28
-
-
Save wahibhaq/1724992 to your computer and use it in GitHub Desktop.
shellscripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This code will help in renaming multiple files in a folder in a specific format. | |
# e.g $ ./customfilerename test/ will convert all files to Image0, Image1, Image2 etc. | |
# folder: no trailing slash $1 | |
folder=$1 | |
index=0; | |
files=`ls -1 $folder` | |
for file in $files ; do | |
echo $file | |
fileName="Image"$index".png" | |
echo $fileName; | |
if [ -f $folder/$file ]; | |
then | |
mv $folder/$file $folder/$fileName | |
index=$(($index+1)) | |
#echo $index; | |
fi | |
done | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment