I have many folders of mp3 files, and I would like to have a list of the combined duration of all the mp3s in each folder. That would be the ideal solution, but some means of doing a directory print attaching the individual mp3 duration would also be good. Any help would be much appreciated. I am running Windows 7 Home Premium, but have access to a number of other Windows/Mac OS.

Edit - I actually found an solution using the export function in the freeware program Tagscanner.

  • 1
    I have a WPF application I wrote that will do that (amongst other things), but I haven't uploaded it anywhere yet - still really for internal use only. However, if nothing else come up I could let you have a copy.
    – ChrisF
    Commented Jan 11, 2011 at 22:01
  • @ChrisF hi can you please give the link to your program that shows mp3 folder length Commented Apr 20, 2020 at 19:25

4 Answers 4


If you're working on Mac OS or any Unix system you can install ffmpeg and use the following command to extract the duration of a single file:

ffmpeg -i filename.mp3 2>&1 | egrep "Duration" | cut -d ' ' -f 4 | sed s/,//

That would for example return "00:08:17.4".

You can use this in a shell script of course, so for example this would list all of the mp3 files in a folder and their duration to the right.

# call me with mp3length.sh directory
# e.g. ./mp3length . 
# or ./mp3length my-mp3-collection

for file in $1/*.mp3
    echo -ne $file "\t"
    ffmpeg -i "$file" 2>&1 | egrep "Duration"| cut -d ' ' -f 4 | sed s/,//

The following script returns total duration in hours:

# call me with mp3length.sh directory
# e.g. ./mp3length .
# or ./mp3length my-mp3-collection

list-individual-times() {
    for file in $1/*.mp3
        echo -ne $file "\t"
        ffmpeg -i "$file" 2>&1 | egrep "Duration"| cut -d ' ' -f 4 | sed s/,//

TOTAL_HOURS=$(list-individual-times $1 | cut -f2 | xargs -I hhmmss date -u -d "jan 1 1970 hhmmss" +%s | awk '{s+=$1}END{print s/3600}')
echo "Total hours: ${TOTAL_HOURS}"

You can get it easily with oneliner:

$ for file in *.mp3; do mp3info -p "%S\n" "$file"; done | paste -sd+ | sed 's+\(.*\)+(\1)/60+' | bc


  • mp3info: gets individual mp3 length in seconds
  • paste: merge column result with + as separator
  • sed: put () around sum and divides by 60 (minutes
  • bc: perform arithmetic operation
  • put this directly in cmd once you cd to the directory path or what ? this works in what OS. it didnt work for me on win10
    – user583843
    Commented Oct 27, 2020 at 15:57
  • $foo means bash, so this is *nix OS. On windows you can use MSYS2
    – albfan
    Commented Nov 4, 2020 at 9:47

You can add a column to the file list in Wİndows Explorer. Add "Length" property colum to folder. Then select all off the mp3 files in the folder. You can see total length in the bottom summary pane of win.exp...

(Not the whole solution to your question but you said "any help would be appreciated :D)

  • Thanks, this is pretty much what I do at the moment. The problem is these files are across many hard drives, so I want to be able to export this info to use in spreadsheets and the like without doing it all manually.
    – Anastasia
    Commented Jan 12, 2011 at 6:49
  • The total length didn't show up in the status bar of Windows Explorer for me (Windows 10), but did show up when I chose View > Details pane from the ribbon (discovered here). Thanks!
    – Sam
    Commented Nov 30, 2022 at 20:52

A little late in the day (decade!), but I wanted to do exactly the same thing. Thanks to Windows Powershell, here is a little script that I wrote today.

$path = '~\MS Subbulakshmi\1. Toronto 1977\'
$shell = New-Object -COMObject Shell.Application
$folder = $path
$shellfolder = $shell.Namespace($folder)
$total_duration = [timespan] 0
foreach($file in Get-ChildItem $folder)
    $shellfile = $shellfolder.ParseName($file.Name)
    $total_duration = $total_duration + [timespan]$shellfolder.GetDetailsOf($shellfile, 27);
Write-Host "Total Duration of $folder is $total_duration"

The output would be something like this

Total Duration of ~\MS Subbulakshmi\1. Toronto 1977\ is 01:52:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .