Guest User

DaCeige

a guest
Dec 9th, 2009
2,078
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
  3. Set objFolder = objFSO.GetFolder("C:\Users\DaCeige\Music\iTunes\iTunes Music")
  4. Set colSubFolders = objFolder.Subfolders
  5.  
  6. 'get inside each artist's folder
  7. For Each objSubFolder in colSubFolders
  8.     'Wscript.Echo objSubFolder.Name
  9.     'once inside the folder do the following...
  10.     Set colSubSubFolders = objSubFolder.Subfolders
  11.     'Get inside each album folder
  12.     For Each objSubSubFolder in colSubSubFolders
  13.         'once inside do the following
  14.         'WScript.Echo vbtab & objSubSubFolder.name
  15.         Set colMP3Files = objSubSubFolder.Files
  16.         For Each objMP3File in colMP3Files
  17.             'Wscript.Echo vbtab & objMP3File.Name
  18.             strCurrentMP3Name = objMP3File.Name
  19.             For Each objMP3File2 in colMP3Files
  20.                 'Wscript.Echo Left(strCurrentMP3Name, Len(strCurrentMP3Name)-4) & vbtab & Left(objMP3File2.Name, Len(objMP3File2.Name)-6)
  21.                 If UCase(Left(strCurrentMP3Name, Len(strCurrentMP3Name)-4)) = UCase(Left(objMP3File2.Name, Len(objMP3File2.Name)-6)) Then
  22.                     'Wscript.Echo(UCase(strCurrentMp3Name & vbtab & objMP3File2.Name))
  23.                     'WScript.Echo objMP3File.Size & vbTab & objMP3File2.Size
  24.                     WScript.Echo "1" & vbTab & objMP3File.Size & vbTab & UCase(strCurrentMp3Name)
  25.                     WScript.Echo "2" & vbTab & objMP3File2.Size & vbTab & UCase(objMP3File2.Name)
  26.                     MP3Size1 = objMP3File.Size
  27.                     MP3Size2 = objMP3File2.Size
  28.                     MP3SizeDiff = objMP3File.Size - objMP3File2.Size
  29.                     WScript.Echo "-" & vbTab & MP3SizeDiff
  30.                     If (MP3SizeDiff > -10000) Then
  31.                         WScript.Echo "*" & vbTab & "DELETE2" & vbTab & objMP3File2.Name
  32.                         objFSO.DeleteFile(objMP3File2.Path)
  33.                     Else
  34.                         WScript.Echo "*" & vbTab & "DELETE1" & vbTab & objMP3File.Name
  35.                         objFSO.DeleteFile(objMP3File.Path)
  36.                         WScript.Echo "*" & vbTab & "RENAME" & vbTab & objMP3File2.Name & " -> " & strCurrentMP3Name
  37.                         objMP3File2.Name = strCurrentMP3Name
  38.                     End If                 
  39.                     WScript.Echo " "
  40.                 End If
  41.             Next
  42.         Next
  43.     Next
  44. Next
  45.  
  46.  
RAW Paste Data