Delete files from your iTunes library (javascript)
I found out yesterday that, when you delete files from your iTunes library, they are not deleted physically from your hard drive.
This is the case on Windows machines when you define a separate folder from where to build the library.
So, when you add new music to that folder, re-import it again, the deleted files are "revived".
Being a developer, I figured I could do something about that. So that's what I did today. Spend some time looking at samples and such. I never worked with Javascript that way, but it was nice. If you are interested, here is the source code: moveitunesoutcasts
When I found something useful by other devels, I added the source of that code.
Why is it called itunesoutcasts? Well, they are the files I excluded from my iTunes library, so they are "not welcome anymore".
You could easily modify the script so they are deleted instead of moved, but that's something I found a bit tricky: if you specify a folder that contains files (any file, even regular documents) that are NOT in your iTunes library, the entire folder and subfolder structure will be wiped. So, use at your own risk.
USAGE:
- download the file
- modify line 7 to reflect the location of your music files THAT ALSO ARE in your iTunes library!!!
(var strMusicfolder = "%userprofile%Musicmuziektest"; // Location of the folder from which the files to delete)
- comment line 123 by ading 2 forward slashes // to the beginning of the line
(// enumFile.item().Move(strTargetFile);)
- rename it's extension from .txt to .js
- doubleclick the file moveitunesoutcasts.js
- Verify the file itunesoutcasts.log that all the right files have been moved
- modify line 123 again by removing the 2 forward slashes // again
- doubleclick the file moveitunesoutcasts.js
Now the outcast files are actually moved to the directory specified.