2
Convert File Names to Alphabet Letters
For example, I have several image/photo files in a directory, and I want to pass these long names of the respective images in names designated by letters of the alphabet
Before
IMG01-03082016.jpg
IMG02-03082016.jpg
IMG03-03082016.jpg
etc. ...
Afterward
A.jpg
B.jpg
C.jpg
etc. ...
What if the number of files is greater than the number of letters in the alphabet? How would you name the files that are outside the alphabet range?
– gato
ls *.jpg /| head -26 | perl -nlE 'system ("echo mv $_ ". chr(64+$.).".jpg")'
and erase the "echo" if it looks good to you...– JJoao
@Dener Carvalho Actually, I do not intend to leave inside the directory more than 26 images that in numbers corresponds to the alphabet. OK!
– Diego Henrique
@Diegohenrique, as noted in the commentary, if he is "showing" the intended operation, removes the "echo"
ls *.jpg /| head -26 | perl -nlE 'system ("mv $_ ". chr(64+$.).".jpg")'
.– JJoao