Edit mp3 File Names

This is a discussion on Edit mp3 File Names within the C Programming forums, part of the General Programming Boards category; hey, i have a problem where i burned a backup cd in linux and then when i opened the cd ...

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    Edit mp3 File Names

    hey, i have a problem where i burned a backup cd in linux and then when i opened the cd in windows.. all of the filenames on the cd were all caps and had no spaces, but underscores. i know how to make a list of all the files in a dir, but what i want to do is write a program to change the case of the actual file names and replace the underscores with spaces. i can do all of the actual editing, but i'm not sure how to go about reading in each file name. so how do i do that? thanks
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    unfortunaly, there is no standard way of doing this...

    fortunatly though, this doesn't need to be portable

    let me direct you to:
    http://users.actcom.co.il/~choo/lupg...html#directory



    edit: in case you overlook it in the text, remember that "." and ".." are always always included
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    '' Use notepad to save as "FixFileNames.vbs"
    '' Update sFolder variable (remember trailing backslash)
    '' Run by double clicking or on command line with:
    '' cscript FixFileNames.vbs
    
    Const sFolder = "C:\SomeFiles\"
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    For Each file In fso.GetFolder(sFolder).Files
    
       sNewFileName = Replace(file.Name, "_", " ")
       sNewFileName = LCase(sNewFileName)
    
       If (sNewFileName <> file.Name) Then
          WScript.Echo "Changing '" & file.Name & "' to '" & _
                       sNewFileName & "'..." & vbCrLf
    
          file.Move sFolder & sNewFileName
       End If
    
    Next
    Last edited by anonytmouse; 04-10-2005 at 03:03 PM. Reason: Added instructions

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    Quote Originally Posted by anonytmouse
    Code:
    Const sFolder = "C:\SomeFiles\"
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    For Each file In fso.GetFolder(sFolder).Files
    
       sNewFileName = Replace(file.Name, "_", " ")
       sNewFileName = LCase(sNewFileName)
    
       If (sNewFileName <> file.Name) Then
          WScript.Echo "Changing '" & file.Name & "' to '" & _
                       sNewFileName & "'..." & vbCrLf
    
          file.Move sFolder & sNewFileName
       End If
    
    Next

    ewwwwe - don't post that kind of stuff around here
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >> ewwwwe - don't post that kind of stuff around here <<

    Maybe this is better?
    Code:
    /* Use notepad to save as "FixFileNames.js"
     * Update sFolder variable (remember trailing backslash)
     * Run by double clicking or on command line with:
     * cscript FixFileNames.js */
    
    var sFolder = "C:\\SomeFiles\\";
    
    var fso = new ActiveXObject("Scripting.FileSystemObject")
    
    for ( var e = new Enumerator(fso.GetFolder(sFolder).Files);
          !e.atEnd();
          e.moveNext() )
    {
       var sNewFileName = e.item().Name.replace(/_/g, " ");
       sNewFileName = sNewFileName.toLowerCase();
    
       if ( sNewFileName != e.item().Name )
       {
          WScript.Echo("Changing '" + e.item().Name + "' to '" +
                       sNewFileName + "'..." + "\r\n");
    
          file.Move(sFolder + sNewFileName);
       }
    }
    Last edited by anonytmouse; 04-10-2005 at 03:07 PM. Reason: Added instructions.

  6. #6
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    much better, thank you

    it's just not code if you're able to read it
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    > i know how to make a list of all the files in a dir
    ...
    > but i'm not sure how to go about reading in each file name
    Well, which is it?

    Perhaps the real answer is to pick different options on your CD burning software?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    well picking different options for my cd burning software doesn't help me with the cd i've already burned, nor does it help me with the problem at hand
    but in the future of course i plan to do so as this is a pain. lol



    > i know how to make a list of all the files in a dir
    ...
    > but i'm not sure how to go about reading in each file name
    Well, which is it?
    making a list of files = taking each entry in the folder and storing it in a text file. it can be done as simply through a DOS prompt, dir /s /b > dir.txt

    which is it? it is what i said, lol, i can't edit the actual filename of a file in the directory.
    Last edited by willc0de4food; 04-10-2005 at 01:38 AM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  9. #9
    Registered User
    Join Date
    Apr 2005
    Posts
    12
    I'm just trying to understand anoytmouses code...is this even C? or some type of pseudocode?

    I looked for ActiveXObject and I mainly get stuff on javascript...and what the heck is this var stuff and odd type of declaration for an enumerator?

  10. #10
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    anonytmouse, may i ask how i'm supposed to use / compile / execute that code?

    note: i'm writing / executing this program in Windows XP
    thanks guys



    thats EXACTLY what i was thinking icebreakingfool.. lol
    Registered Linux User #380033. Be counted: http://counter.li.org

  11. #11
    Registered User
    Join Date
    Apr 2005
    Posts
    12
    http://www.eskimo.com/~scs/cclass/int/sx2j.html

    maybe that will help...i was just reading this stuff

  12. #12
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    hmm..thanks looks promising.
    Registered Linux User #380033. Be counted: http://counter.li.org

  13. #13
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    wait a minute.......isn't linux open source? hmmmmmmm....... how could we resolve this situation?...............hmmmmmmmmmmmmmmmmmmmmmmmm mmm.....maybe we could - no, nevermind, i lost it....
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  14. #14
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    how does linux being open source and you being indirect about what i should do have anything to do with not understanding the code given by anonytmouse?
    Registered Linux User #380033. Be counted: http://counter.li.org

  15. #15
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    absolutely nothing

    linux is open source which means you have the source code correct? hypothetically, what if, just what if you changed the code to your personal liking? you know, so that you don't get the uppercase letters to begin with.


    by the way, tmouse's first code is VB script. The second is J(ava)script.
    Last edited by misplaced; 04-10-2005 at 02:48 AM.
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  3. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21