Move files to MP3 players with HDD

This might be interesting for you if you


Then copying files to your player will probably result in heavy inconvenience. Most MP3 playres don't offer any search functions. And so it will take hours to browse through this one big directory on the MP3 player and select one specific song.

The solution

are two little scripts I've programmed in VBS language (Visual Basic Script) which should run on most Windows computers. If not you must install the Windows Scripting Host.

The first script creates directories on the MP3 player from A to Z and 0 to 9. The songs from your big PC directory will be copied into these player-directories depending on the first letter. The script also checks if the timestamp of the file has changed. If so, it will be updated on the player.
Important: You must adjust the path names in the script. That's why I just give you the source code here. Copy it, save it with as an *.VBS-file and then just double-click on it in the file-explorer.

dim fo,p1,p2,p2a,log,f1,f2,folder,f1f,f2f
Set fo = CreateObject("Scripting.FileSystemObject")
Set Log = Fo.CreateTextFile("c:\log.txt", True)
p1 = "C:\MP3\"								'enter here your PC-MP3 directory
p2 = "g:\"									'enter here the path to your MP3 player

Set Folder=fo.getfolder(p1)	
Set Files = folder.files
For Each File in files 
If fo.GetExtensionName(file.path)="mp3" then	
  cfile=file.name
  f1 = p1 + cfile
  p2a = p2 + LCase(Left(cfile, 1)) + "\"
  f2 = p2a + left(cfile,63)
  If Not Fo.folderexists(p2a) Then
     Fo.createfolder (p2a)
     Log.writeline ("Dir: " + p2a)
     End If
  If Fo.fileexists(f2) Then
    set f1f=fo.getfile(f1)
    set f2f=fo.getfile(f2)
    log.write("compare " & f1f.datelastmodified)
    log.writeline("with " & f2f.datelastmodified)
    If not (f1f.datelastmodified = f2f.datelastmodified) Then fmove
    Else: fmove
    End If
  end if
 next
log.close
wscript.quit

Sub fmove()
set f1f=fo.getfile(f1)
f1f.copy p2a
Log.writeline (f2)
End Sub

If you delete songs you don't like on your PC, you will probably want to delete them on the MP3 player, too, as soon as you connect it the next time. For this purpose I've written the next script. You need to adjust the paths again.

dim fo,p,p1,p2,p3,log,f1,f2,folder1,folder2,f2f,x
Set fo = CreateObject("Scripting.FileSystemObject")
Set Log = Fo.CreateTextFile("c:\log2.txt", True)
p1 = "C:\MP3\"   								'enter here your PC-MP3 directory
p  = "g:\"									'enter here the path to your MP3 player
f3 = p + "del\"
Set Folder1=fo.getfolder(p1)	

For x= 97 To 122
  p2 = p+chr(x)+"\"
  if Fo.folderexists(p2) Then
    Set folder2=fo.getfolder(p2)
    Set files = folder2.files
    For Each File in files 
      cfile=file.name
      f1 = p1 + cfile
      f2 = p2 + cfile

      if Not Fo.fileexists(f1) then fmove
      Next
    End If    
next
log.close
wscript.quit

Sub fmove()
fo.MoveFile f2,f3
Log.writeline (f2)
End Sub
Executing this will move all supposed files into the del/ directory of your MP3 player. The del-directory must be created before you run the script.


Radiovibrations.com -> experience