Skip to content

Instantly share code, notes, and snippets.

@wahibhaq
Created February 2, 2012 18:28
Show Gist options
  • Save wahibhaq/1724992 to your computer and use it in GitHub Desktop.
Save wahibhaq/1724992 to your computer and use it in GitHub Desktop.
shellscripts
#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