Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a folder full of MP3s that I'd like to get into the proper folders easily.

    Currently they reside in G:\MP3\New\Unfiled

    I'd like them all to reside in this folder structure

    G:\MP3\Rock\<Artist> where <Artist> is the Artist from the Artist tag in the MP3 file itself.

    Any pointers?

    Thanks!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Abraxus' post='778992' date='09-Jun-2009 13:30']I have a folder full of MP3s that I'd like to get into the proper folders easily.[/quote]
    Er, sort of, although my software skills are currently under a cloud

    I have had dropped on me 20GB of music files. My job is to tidy up the folder tree.
    I am attaching a work-in-progress UserGuide.

    So far I have reduced file space by 33% just by eliminating duplicate tracks (*) within each folder.
    I eliminated more by eliminating duplicate tracks within the folder tree.
    I am now enhancing a better technique, which includes a GUI form to allow the user to sample tracks ("PLAY") prior to deletion.
    I have plans to assemble the contents of separate folders into a single folder so that a folder "Genius Loves Company" which appears frequently throughout the tree with only one track per instance (always Ray Charles, but this time with Willie Nelson, next time with John Lennon, Chris Greaves etc.) can be assembled into a single "Ray Charles" folder.
    I have macros to delete any non-accredited files (WMA, MP3, WAV etc)

    Since the application uses ShellExecute to "play" a track, it ought to be just as good at cleaning up a folder tree of images (BMP, JPG etc), or a folder tree of documents (DOC, RTF, WPD etc.)

    (*) I strip the name of the extent and of all non-alphabetic characters - the cheap man's Soundex search - to reach a status of "probably a duplicate"
    Attached Files Attached Files

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Here's code you can use. You can copy it into a module in any Office application and run it from there.

    Make a backup before trying it, to be on the safe side!

    Code:
    Sub MoveMP3()
      Const intRecordLen = 128
      ' The following constants should end in a backslash!
      Const strSourcePath = "G:\MP3\New\Unfiled\"
      Const strDestRoot = "G:\MP3\Rock\"
    
      Dim strDestPath As String
      Dim strFile As String
      Dim lngFileLen As Long
      Dim tag As MP3Tag
      Dim strArtist As String
      Dim f As Integer
      Dim intP As Integer
      Dim arr() As String
      Dim n As Integer
    
      ' Loop through MP3 files in source folder
      strFile = Dir(strSourcePath & "*.mp3")
      Do While Not strFile = ""
    	lngFileLen = FileLen(strSourcePath & strFile)
    	f = FreeFile
    	Open strSourcePath & strFile For Binary Access Read As #f
    	' Read MP3 tag
    	Get #f, lngFileLen - intRecordLen + 1, tag
    	Close #f
    	If tag.ID = "TAG" Then
    	  ' If it's a valid MP3, get artist name
    	  strArtist = Trim(tag.Artist)
    	  intP = InStr(strArtist, Chr(0))
    	  If intP > 0 Then
    		strArtist = Left(strArtist, intP - 1)
    	  End If
    	  strDestPath = strDestRoot & strArtist & "\"
    	  ' Store info in array
    	  n = n + 1
    	  ReDim Preserve arr(1 To 2, 1 To n)
    	  arr(1, n) = strDestPath
    	  arr(2, n) = strFile
    	End If
    	strFile = Dir
      Loop
    
      ' Loop through array
      For n = 1 To UBound(arr, 2)
    	strDestPath = arr(1, n)
    	strFile = arr(2, n)
    	If Dir(strDestPath, vbDirectory) = "" Then
    	  ' Create folder if it doesn't exist yet
    	  MkDir strDestPath
    	End If
    	' Move file
    	Name strSourcePath & strFile As strDestPath & strFile
      Next n
    End Sub

Posting Permissions

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