
If you’ve ever wanted to see how long you’ll be playing a particular artist’s music for, if you were to play their entire discography, I present a one-liner in bash that will show you just that.
find . -type f -name '*.mp*' -exec exiftool '{}' + | grep Duration | awk '{x += $3; print x;}'
The venerable find command needs no introduction. Suffice it to say that the type switch restricts it to files, and the *.mp* restricts the files found to MP3s or MP2s.
Exiftool is a nifty command-line processing tool for tags of all kinds, as seen by its name. In this case, we want just the ‘Duration’ field of each song. Once we have those, we pipe those to awk and get a running total, which shows us how long the entire discography is when the final total is printed.
Now I know that I have 5668.14 minutes of Zappa goodness, or a mere 208 minutes of godly Death. You need to run this in the folder that has all the albums by the artist, or of course, you can adapt it to a script and pass in parameters and so on.

Related Articles
No user responded in this post
Leave A Reply