I have tons of image inside a folder and it also has different file types. I have tried googling for an answer but I can’t seem to find one. I wanted the files to be named 1.jpg, 2.png, 3.gif. . . n.JPEG. Could someone help me out with this?
Advertisement
Answer
Try the command below:
cd path_to_your_files declare -i i=0; for f in *; do i=$((i+1));fn=$i".${f##*.}"; mv "$f" "$fn"; done
Make note that the command above is a bash script.