I need to rename the '*.mp3' songs but I don't know how to change name for each and every song in a directory. Does anyone know how to do it?
I need to rename my .mp3 files like this:
Aaaa.mp3
Aaab.mp3
Aaac.mp3
Aaad.mp3
...
Aaaz.mp3
Baaa.mp3
Baab.mp3
...
...
Zzzz.mp3
I know how to change the name for a single file. But, not prefer to change each name manually.
first generate the filename template and store them in array mode, then travers on .mp3
files and rename them with the name read from the array:
arr_name=( $(printf '%s\n' {A..Z}{a..z}{a..z}{a..z}) )
i=0; for file in ./*.mp3; do echo mv "$file" "${arr_name[i++]}.mp3"; done
unset arr_name #unset array after all
mv ./files1.mp3 Aaaa.mp3
mv ./files2.mp3 Aaab.mp3
mv ./files3.mp3 Aaac.mp3
…
remove echo
in front of the mv
command to get ride of the dry-run to perform rename on files.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments