Tech Tips | Bulk Editing Filenames (Mac OSX)

One thing I do fairly often is export songs from iTunes on to USB Flash Disk; mainly because my car has an internal hard drive and I want to update my song list. Unfortunately, when you drag songs out of iTunes into a Finder folder, each filename has the track number appended to it at the beginning. Example, all files are named like below (please don’t judge the song selection!):

Bulk Edit Filenames Finder Mac


You can edit these manually, but here’s a quick trick using Terminal.

  1. Open Terminal
  2. Change your directory to the folder containing music, i.e.
    cd Desktop/Music/Roy
  3. Check if you’re in the right folder using the ls command.
  4. In my case, I want to trim the first 3 characters, so I use the following command:
    for f in *;do mv “$f” “${f:3}”;done
  5. Check the files again using ls command

Tech Tips | Bulk Editing Filenames (Mac OSX)

And voila, you’re done! In case you want to cut out more characters, change the number “3”, to the value of your choice.