Having difficulty with VBScripting

Soldato
Joined
27 Dec 2011
Posts
5,741
Hey folks,

I've somehow managed to create a long list of duplicate items in my iTunes library. Short of going through and individually deleting 1,500+ songs, my only other option is to run a VBScript to delete them off.

I managed to find this;

http://www.methodshop.com/gadgets/ipodsupport/duplicates/DupKiller.txt

I've altered the script to include my name, rather than the person who created it, and ensured it is saved with the extension .vbs but when I run it up absolutely nothing happens. I am sure it has something to do with the root file, because tweaking with that sometimes throws this error message;

Code; 800A0408
Source; Microsoft VBScript compilation error

Has anyone else tried this solution to iTunes duplicate files, or can anyone advise as to where I am going wrong?

Many thanks.
 
Can you post your edited version?

Remove the ':

'Wscript.Echo objSubFolder.Name

So it is:

Wscript.Echo objSubFolder.Name

Does it echo out sub folders?
 
Last edited:
I have tried taking the apostrophe out, then I get a window pop up telling me every single artist I have with the option to click OK.

Current script;

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
 
Back
Top Bottom