How can I locate missing files using Perl?

Adam Howell September 2, 2011
Pinterest Stumbleupon Whatsapp
Ads by Google

I have a large CD collection that I have ripped to .aac on my hard drive. I recently noticed that some albums are missing track 1, but have the rest of the tracks. I need a good way to locate albums that need to be re-encoded.

My ripper (WinAmp) formatted the filenames – – – . An example filename looks like this:
Rush – Presto – 01 – Show Don’t Tell.m4a

“TrackNumber” is zero-padded so it will always be two digits. So I need a list of every directory that has .m4a files in it, but NONE of the filenames contain ” – 01 – “. I have already piped “ls -aR1” to a text file.

I considered using diff against a file with “- 01 -” and one with “- 02 -” to meet my needs, but want to know Perl a little bit better.

  1. Tina
    September 4, 2011 at 11:20 am


    did the information provided by ha14 help to solve your issue? Please let us know!

  2. Anonymous
    September 3, 2011 at 4:22 pm

    Using perl to list files in a directory

    How do I list the files in a directory?

    Perl tutorial