Forrest logo
back to the find tool

find:ai:4874a

ass a id3v2 track number tag in alphabetical to files using find sort and xargs
$ find . -type f -name '*.mp3' -exec id3v2 -T {} \; | sort -t : -k2,2n | xargs -I {} mv {} $(printf "%02d\n" $(printf {} | cut -d : -f 2))
try on your machine

This command first finds all .mp3 files in the current directory and its subdirectories, then extracts the track number tag for each file using id3v2 and sorts them in numerical order. Finally, it renames the files with a padded track number at the beginning in the format 01_track_name.mp3

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • ass a id3v2 track number tag in alphabetical to files using find sort and xargs ?
back to the find tool