Answers for "number all files in a folder"

0

number all files in a folder

a=1
for i in *.jpg; do
  new=$(printf "%04d.jpg" "$a") #04 pad to length of 4
  mv -i -- "$i" "$new"
  let a=a+1
done
Posted by: Guest on June-17-2020
0

number all files in a folder

ls -v | cat -n | while read n f; do mv -n "$f" "$n.ext"; done
Posted by: Guest on June-17-2020

Code answers related to "number all files in a folder"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language