• Duration of music folder (XP Home SP2)

    Author
    Topic
    #427097

    How to get the music duration of each folder and subfolder in my hard drive? The Windows Explorer displays only the duration of each music file within the folder, not the duration of each folder.

    Viewing 1 reply thread
    Author
    Replies
    • #988747

      If you load the (contents of the) folder up into something like Windows Media Player, does it not give you a total playing time?

      • #988810

        Leif,

        Thanks! Yes, I can use Windows Media to see the total playing time by adding folder to the library one at a time. It is very time consuming when there are many folders and files. However, if there are no other faster ways, I will use it.

        • #988813

          You might find Power Desk – an alternative to Windows Explorer – will give you the total running times. (I think it used to be free, but I’m not sure it is any longer.)

        • #988815

          And, if that doesn’t work out, how about this? In this post and others, I mentioned a utility called FileGrab. It’s pretty old and still works in WinXP but you will have to pay a modest fee to download a copy. FileGrab allows you to grab a selected list of files from Windows Explorer and save that list to a text file. You could do a Win Explorer search for MP3 for example, have the columns display duration, select any or all of the files in the usual manner and drag the selection to FileGrab. From there it’s an easy proposition to save the text and turn it into a spreadsheet.

          If you needed to repeat the process for more than one drive or directory, that’s OK too, for FileGrab will let you keep adding to your heart’s content and save when you’re ready.

          Edited With Correction: I just got around to doing a test on my suggestion and I’m sorry to say it DOES NOT work, so save yourself the trouble. It seems that FileGrab only recognizes the columns of info that were around when it was written. I dragged a bunch of files with the duration column included and it’s ignored by FileGrab. Sorry.

    • #1125691

      This (Word 2000 VBA) code will dump all details of all files in a single folder to the current document.
      The code dumps the total duration for the folder as the last line.
      I cloned it from microsoft technet script center

      Sub test()
          Dim objshell
          Dim objfolder
          Dim arrHeaders(35)
          Set objshell = CreateObject("Shell.Application")
          Set objfolder = objshell.Namespace("D:Blotter20080913Music")
          Dim i
          For i = 0 To 34
              arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i)
          Next
          Dim strFilename
          Dim dtDuration As Date
          For Each strFilename In objfolder.Items
              For i = 0 To 34
                  Selection.TypeText vbTab & objfolder.GetDetailsOf(strFilename, i)
              Next
              dtDuration = dtDuration + CDate(objfolder.GetDetailsOf(strFilename, 21))
          Selection.TypeText vbCrLf
          Next
          Selection.TypeText dtDuration & vbCrLf
      End Sub
      • #1125849

        I was inspired to try to add a cut-down version of this (in the form of a VBScript) to Explorer’s right-click menu, but when I try to run the script from the right-click menu, a dialog box pops up that shows the name of the folder and says “Access is denied.”

        It looks like I can run the script from a batch file and assign the batch file to the right-click menu item, but that seems goofy (and it means you get a gratuitous command window popping up). Anybody know why I can’t run the script directly from Explorer’s right-click menu, and if that’s fixable?

        • #1125851

          >try to add … to Explorer’s right-click menu
          OK smarty!
          First question: How do I add something to Explorer’s r/c menu?
          (I can see my client’s tasks flying out of today’s window right now ….)

          • #1125854
            • #1125884

              >Here are Microsoft’s official instructions.
              Thanks st3333ve
              I got a bit of a scare when my printer sprinted into life – serves me right for pasting the batch file without reading it to see what it did!
              I followed steps 1 &2 and it worked. I can’t see why step 3 is required.

              >Anybody know why I can’t run the script directly from Explorer’s right-click menu
              Have you been able to run any script from r/c?

            • #1125885

              If you don’t do step 3, you may well find that double-clicking on a folder (in Explorer) triggers a result other than “Open” — because the default action tends to get screwed up when you make other adjustments (like adding a new menu item). I installed Service Pack 3 last week, and am I surprised that Microsoft has never gotten around to fixing that annoying bug? No, I am not surprised. Not surprised in the least, really. Actually, come to think of it, if they had fixed the bug, I would have been surprised.

              As for your 2nd question: No, no script will run. I made a one-line test script (MsgBox “Howdy”) and got the same “Access is denied” result — and it doesn’t matter whether I use WScript or CScript as the processor.

              I should add that Windows adds “percent-symbol 1″ to the end of the command line (if you don’t), and the “Access is denied” error dialog I’m getting always displays the name of the folder I right-clicked — even when, as in my one-line test script, the script itself isn’t trying to actually access the folder.

              I’m guessing it’s a security thing, although if that’s the case it seems goofy that I can get around the security by simply turning the command line into a batch file and then running the batch file from the right-click menu.

            • #1125928

              >If you don’t do step 3 …
              OK. I went to do it and found (“In the Value data box, type none.”) that my value was already “none”

              >… Windows adds “percent-symbol 1” … name of the folder I right-clicked –
              This sounds to me like half-baked code, the sort that gets released with a few odds and ends left unfinished – debugging code in place – when a programmer is yanked off a module before it is tidied up. The module remains frozen in it 95% state forever. I’ve worked on projects like that.

              >seems goofy … then running the batch file
              Take heart.
              Some of my finest stuff still runs from a batch file, quietly, no fanfare, during boot time or to drive useful applications. I get used to seeing the black window appear, but enjoy getting on with what i have to do.

              I quite agree it seems strange that a script cannot be hooked on to a r/c menu, whereas an executable can be hooked.

            • #1125977

              Just to clarify: Windows doesn’t add the words “percent-symbol” — it appropriately adds the percent-symbol (followed by the number 1). But I don’t know how to put that combination in a Lounge post, so I used the words instead.

            • #1125978

              If you try to include a % symbol immediately followed by a number such as 1, havoc ensues because such combinations play a special role in HTML. You can work around it by placing square brackets around the % symbol: [%]1 will be converted to %1 when posted.

            • #1125982

              Thanks, Hans. I expect I knew that once (or twice) and forgot. (I couldn’t find anything in the Help, but didn’t spend a lot of time searching.)

    Viewing 1 reply thread
    Reply To: Duration of music folder (XP Home SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: