Zmień nazwę plików sekwencyjnie Linux

### Try to use a loop, let, and printf for the padding:
# using the -i flag prevents automatically overwriting existing files, 
# using -- prevents mv from interpreting filenames with dashes as options.

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

# Here's the same example as a 1-liner:
for i in *.jpg; do new=$(printf "%04d.jpg" "$a"); mv -i -- "$i" "$new"; let a=a+1; done
CoderHomie