Results 1 to 18 of 18

Thread: Program to rename / copy mp3 files

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Program to rename / copy mp3 files

    Hey,
    For my mp3 player project I need mp3 files with filenames that are a bit limited.
    Maximum 32 characters, "_" instead of " " and all letters must be uppercase.
    It reminds me of old days when you doenloaded songs and filenames looked like "ARTIST_-_SONG_NAME.mp3".

    I would like to create a program that would rename files to that format and copy them to flash drive or even program in wich you would drag files to create a list that would then get renamed and copied.

    My question is would that be possible in visual basic 6 or should I rather move to something newer like visual studio 2019 for example.

    I would like to use basic 6 is because I dont have much experience in writing programs for windows, but I did made a few apps back in the day in basic 6 and I still remember some things and how to use it.

    I will learn as I go, but I want to know if its even possible in basic 6 before I start.

    Thank you

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Program to rename / copy mp3 files

    Search MSDM for len() and replace() functions (and of course, copy())
    Sam I am (as well as Confused at times).

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Quote Originally Posted by SamOscarBrown View Post
    Search MSDM for len() and replace() functions (and of course, copy())
    Hy thank you. Will check it when I get home from work.

  4. #4
    Lively Member
    Join Date
    Nov 2020
    Posts
    67

    Re: Program to rename / copy mp3 files

    Just for your information, there is already a free program MP3Tag that does this and much more:

    https://www.mp3tag.de/en/

  5. #5
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Program to rename / copy mp3 files

    Why anyone would rename to all Upper case on a Case-agnostic OS escapes me......
    as to the question:
    I love my linux......
    http://manpages.ubuntu.com/manpages/...an1/mmv.1.html
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Quote Originally Posted by LeoFar View Post
    Just for your information, there is already a free program MP3Tag that does this and much more:

    https://www.mp3tag.de/en/
    Wow, thank you for this I tryed it out and it does the job.

    I will still play a bit and see if I can make my own, but if creating the program will give me trouble I will stick to this one.

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    I need to modify filenames like that because otherwise mp3 module player wont read it and return error (We all love chinesse products, dont we? ).
    Yep linux has a good way of doing it, but I want to create program for Windows.

  8. #8

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    I managed to get drag & drop into list working using the following code:
    Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim intFile As Integer

    With Data
    For intFile = 1 To .Files.Count
    List1.AddItem Data.Files.Item(intFile)

    Next intFile
    End With 'Data
    End Sub


    But filenames have path displayed with the filename... How can I hide the path? I`m searching for correct method, but either it doesnt work or it returns error.

  9. #9
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Program to rename / copy mp3 files


  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Thats what I am trying to do, but I dont know how to get String "strFullPath" for:

    GetFileNameFromPath = Right(strFullPath, Len(strFullPath) - InStrRev(strFullPath, ""))


    I would need to get String(s) from List1, then use that function and returnt modified String(s) back into List1 asfar as I understand. But I dont know how.

    Because asfar as I understand:
    List1.AddItem Data.Files.Item(intFile)

    add object and not String or Integer....

  11. #11
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Program to rename / copy mp3 files

    Use split-function on full path with „\“ as delimiter.
    filename is in highest member of the resultarray
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  12. #12

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Quote Originally Posted by Zvoni View Post
    Use split-function on full path with „\“ as delimiter.
    filename is in highest member of the resultarray
    Thank you. Will research and try.

  13. #13

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Any idea why I cant modify or read from text boxes?
    text1.Text = "sample text"
    returns "Method or data member not found" and highlights .Text

    Almost like somethig is missing in the program, I had reinstalled it and it is the same.
    Im running it on Windows 7 x64 as admin with xp sp3 compability mode

    EDIT: Openned new project and it works now.
    Last edited by 0212995500229; Nov 9th, 2021 at 02:13 PM.

  14. #14

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Update: had spent some time coding and I have text-->text2 conversion and text1-->text3-->text--2 almost finished.
    Filename is being copied to text 1 and text2 renames the file.
    If filename is longer than 32 characters text1 is being converted and forwarded to text3 in form2 for hand correction and then to text2.

    Tommorow I must improve file gui and find a way to rename all files in folder at once. Right now I have Drivelist Dirlist and Filelist boxes, but Im not to happy with them.

  15. #15
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Program to rename / copy mp3 files

    There is no "rename all files at once"
    either, you collect all filenames, rename them in memory, and then loop through the result firing off the "name" function
    or you run through your files and rename them in place
    Aircode
    Code:
    Dim MyFiles() As String
    Dim tmpFile() As String
    'Collect FileNames and FileCount
    ReDim MyFiles(1 To 2, 1 To FileCount)
    For i=1 To FileCount
       MyFiles(1,i)=OriginalFileName  'FullPath!!
       tmpFile=Split(OriginalFileName, "\")
       tmpFile(UBound(tmpFile))=UCase(Replace(tmpFile(UBound(tmpFile)), " ", "_"))
       MyFiles(2,i)=Join(tmpFile,"\")
    Next
    For i=1 To FileCount
      Name MyFiles(1,i) As MyFiles(2,i)
    Next
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  16. #16

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    I had solved ""rename all"by using:
    Code:
    For X = 0 To File1.ListCount - 1
        File1.Selected(X) = True

    Now my question is how can I pause loop of Command1_Click() and countinue it with Form2.Command1_Click()?

    The thing is that if filename is to long I open Form2 to manualy correct it (change the String).

  17. #17
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Program to rename / copy mp3 files

    Open Form2 in Modal mode
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  18. #18

    Thread Starter
    New Member
    Join Date
    Nov 2021
    Posts
    11

    Re: Program to rename / copy mp3 files

    Quote Originally Posted by Zvoni View Post
    Open Form2 in Modal mode
    That did the trick. Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width