- Click here to open the VBScript in a new browser window.
- Copy and paste the script into a new Notepad document (Start > All Programs > Accessories > Notepad).
- Edit line #2 and replace "DaCeige" with your username.DaCeige is the methodshop.com reader who wrote the script.
- C:\Users\DaCeige\Music\iTunes\iTunes Music
- Save the Notepad file using a file name like "DupKiller.vbs" Notepad will automatically try to add ".txt" to your text files. You MUST add the file extension ".vbs" to your file.
- Double click on the file called "DupKiller.vbs" on your desktop. This will make a shortcut to the script.
- That's it. Just double click on the shortcut for now on to run the script.
- You may see a warning window from Norton AntiVirus when trying to run this script. Just select the option that allows this script to run. But always be cautious before running a VBScript. Never run a VBScript without inspecting it first. Many times people will try to hide viruses in VBScripts.
-
- Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
- Set objFolder = objFSO.GetFolder("C:\Users\DaCeige\Music\iTunes\iTunes Music")
- Set colSubFolders = objFolder.Subfolders
-
- 'get inside each artist's folder
- For Each objSubFolder in colSubFolders
- 'Wscript.Echo objSubFolder.Name
- 'once inside the folder do the following...
- Set colSubSubFolders = objSubFolder.Subfolders
- 'Get inside each album folder
- For Each objSubSubFolder in colSubSubFolders
- 'once inside do the following
- 'WScript.Echo vbtab & objSubSubFolder.name
- Set colMP3Files = objSubSubFolder.Files
- For Each objMP3File in colMP3Files
- 'Wscript.Echo vbtab & objMP3File.Name
- strCurrentMP3Name = objMP3File.Name
- For Each objMP3File2 in colMP3Files
- 'Wscript.Echo Left(strCurrentMP3Name, Len(strCurrentMP3Name)-4) & vbtab & Left(objMP3File2.Name, Len(objMP3File2.Name)-6)
- If UCase(Left(strCurrentMP3Name,Len(strCurrentMP3Name)-4)) =UCase(Left(objMP3File2.Name, Len(objMP3File2.Name)-6)) Then
- 'Wscript.Echo(UCase(strCurrentMp3Name & vbtab & objMP3File2.Name))
- 'WScript.Echo objMP3File.Size & vbTab & objMP3File2.Size
- WScript.Echo "1" & vbTab & objMP3File.Size & vbTab & UCase(strCurrentMp3Name)
- WScript.Echo "2" & vbTab & objMP3File2.Size & vbTab & UCase(objMP3File2.Name)
- MP3Size1 = objMP3File.Size
- MP3Size2 = objMP3File2.Size
- MP3SizeDiff = objMP3File.Size - objMP3File2.Size
- WScript.Echo "-" & vbTab & MP3SizeDiff
- If (MP3SizeDiff > -10000) Then
- WScript.Echo "*" & vbTab &"DELETE2" & vbTab & objMP3File2.Name
- objFSO.DeleteFile(objMP3File2.Path)
- Else
- WScript.Echo "*" & vbTab &"DELETE1" & vbTab & objMP3File.Name
- objFSO.DeleteFile(objMP3File.Path)
- WScript.Echo "*" & vbTab &"RENAME" & vbTab & objMP3File2.Name & " -> " & strCurrentMP3Name
- objMP3File2.Name = strCurrentMP3Name
- End If
- WScript.Echo " "
- End If
- Next
- Next
- Next
- Next
Read more:http://www.methodshop.com/gadgets/ipodsupport/duplicates/index.shtml#ixzz1Ar70rLTC