Share via

get list of audio files length

Anonymous
2019-02-17T15:51:56+00:00

i m using windows 10, i just want a list of audio files contents, for this i tried cmd, n i get list of my audio folder's files contents... but problem is that its doesnt show me detail of file length/duration... actually i m volentury working for one ashram for uploading data on their web, for this i need to creat a list of every audio files contents.... if it is possible, easy n convient for u to guide me how to do... i tried to find online solution but i havent knowledge of cmd or any programming language.

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2019-02-18T20:09:53+00:00

    You need to do this:

    1. Mark and copy the code you see further down.
    2. Open your .vbs file for editing.
    3. Delete all existing content.
    4. Paste the code.
    5. Save and close the .vbs file.
    6. Use File Explorer to locate your Music folder.
    7. Grab the music folder with your left mouse button, then drop it on the .vbs file. You need to aim carefully. If you miss the .vbs file then File Explorer will copy your Music folder to the desktop (which you do not want!).

    '-------------------------------------------------------------

    'Extract meta data details from a folder containing .mp3 files

    '18.2.2018 FNL

    '-------------------------------------------------------------

    Dim oFSO, oShell, oWshShell, oShellFolder

    Dim sFolder, aCols, sTarget, oTarget, sTitle, sLine, bFirst, iCount

    Prepare

    ProcessFolders(sFolder)

    oTarget.Close

    MsgBox iCount & " files processed." & vbLf _

        & "Results are stored on the desktop in the list ""Music Files.csv""", 64, sTitle

    oWshShell.Run """" & sTarget & """", 1, False

    '----------------------------------------

    'Recursively process the nominated folder

    '----------------------------------------

    Sub ProcessFolders(sFldr)

        ProcessOneFolder(sFldr)                'extract meta data from the .mp3 files in this folder

        For Each oSubFolder In oFSO.GetFolder(sFldr).SubFolders

            ProcessFolders(oSubFolder.Path)    'process all subfolders in this folder

        Next

    End Sub

    '----------------------------------------------

    'Process all .mp3 files in the nominated folder

    '----------------------------------------------

    Sub ProcessOneFolder(sFldr)

        bStart = True

        Set oMusicFolder = oFSO.GetFolder(sFldr)

        For Each oFile In oMusicFolder.Files

            If LCase(Right(oFile.Name, 4)) = ".mp3" Then

                If bStart Then oWshShell.Popup "Processing """ & sFldr & """", 2, sTitle, 64

                bStart = False

                iCount = iCount + 1

                Set oShellFolder = oShell.Namespace(sFldr)

                If bFirst Then

                    bFirst = False

                    sLine = "File name" & vbTab

                    For Each iCol In aCols

                        extract iCol, oFile.Path, True

                    Next

                    oTarget.WriteLine sLine

                End If

                sLine = oFile.Path & vbTab

                For Each iCol In aCols

                    Extract iCol, oFile.Name, False

                Next

                oTarget.WriteLine sLine

            End If

        Next

    End Sub

    '--------------------------------------------------------

    'Extract the meta data column data for the specified file

    '--------------------------------------------------------

    Sub Extract(n, sItemName, bHeader)

        sItem = Trim(oShellFolder.GetDetailsOf(oShellFolder.Parsename(sItemName), n))

        If n = 28 Then

            If bHeader _

            Then sItem = sItem & " (kBits/s)" _

            Else sItem = Mid(sItem, 2, Len(sItem) -5)

        End If

        sLine = sLine & sItem & vbTab

    End Sub

    '--------------------

    'Prepare a few things

    '--------------------

    Sub Prepare

        Set oFSO = CreateObject("Scripting.FileSystemObject")

        Set oShell = CreateObject("Shell.Application")

        Set oWshShell = CreateObject("WScript.Shell")

        If wscript.Arguments.count = 0 _

        Then Error "You must give the script the full name of your music folder!"

        sFolder = oFSO.GetFolder(WScript.Arguments(0)).Path    'Include the full path if necessary

        If Not oFSO.FolderExists(sFolder) Then Error "Cannot find the folder """ & sFolder & """."

        sTitle = "MP3 File Analyzer"

        sTarget = oWshShell.SpecialFolders("Desktop") & "\Music Files.csv"

        On Error Resume Next

        Set oTarget = oFSO.CreateTextFile(sTarget, True, True)

        iErr = Err.Number

        On Error Goto 0

        If iErr <> 0 Then Error "The target file """ & sTarget & """ is in use!"

        aCols = Split("1 3 27 28")    'size, date, length, bit rate

        bFirst = True

        iCount = 0

    End Sub

    '----------

    'Error exit

    '----------

    Sub Error(sMsg)

        MsgBox sMsg, 48, sTitle

        WScript.Quit

    End Sub

    3 people found this answer helpful.
    0 comments No comments

17 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-02-18T11:41:41+00:00

    Frederik Long... I follow it step by step and I get this result.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2019-02-17T16:45:27+00:00

    Just a slight omission to the above - To open a directory in web browser, type

    file:/// and paste your directory path right after this.

    E.g. file:///C:/Users/kenny/Music/My Album/

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2019-02-17T16:42:52+00:00

    Hi Mehulchanpura,

    Thanks for posting your query! It's an interesting job you are doing, hats off!

    I am Kenny, Independent Advisor.

    I had a go at trying to dump a list of audio files in Windows Explorer but there is currently no such function in Windows 10 to do it automatically (not without installing 3rd party software.)

    However I found a way to save time by using a web browser to create a folder manifest to import to a spreadsheet program.

    Here's what I did:

    1. Open your audio files folder and copy out the directory path (highlight everything in the address bar, Ctrl - C)
    2. Open your web browser. I'm using Google Chrome as an example.

    Type file:/// and paste your directory path right after this. 

    E.g. file:///C:/Users/kenny/Music/My Album/

    1. Ctrl A to select all, Ctrl V to paste the index contents in your spreadsheet program (OpenOffice Calc shown)
    2. Notice the browser doesn't show the duration of the tracks. I added a column in the spreadsheet to complete my file tracker.

    This manual use of a web browser and a spreadsheet to track folder inventory isn't a fully automated solution, as it's a manual manifest, but it doesn't require any 3rd party tools or coding to accomplish.

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2019-02-17T16:12:38+00:00

    Getting the length of music files in a Command Prompt requires a script.

    Getting it in File Explorer is easy. All you need is to make the "Length" column header visible, then click it for sorting. 

    If you lack the Length column header, right-click any column header (e.g. "Title"), then click "More", then place a tick mark against "Length".

    1 person found this answer helpful.
    0 comments No comments