move watched iTunesU video to another folder I'd like to write a script which will move watched iTunesU videos to another folder. There are two questions:


How to find these videos? Automator is able to filter tracks based on play count, but apparently the tracks do not include iTunesU video
How to prevent iTunes from re-downloading these videos again?
You can't easily do it with Automator's actions directly, but you can with AppleScript (which you can wrap in an Automator action if you need).

This AppleScript will get all the iTunes U items that have been watched at least once and move them to a folder you specify.


Note that this does not remove them from iTunes, and you can still play them from iTunes (this is because of how OS X apps track files - in most apps you can move a file you have open and the app can still access it as if nothing has happened).
If you want to remove the item from iTunes altogether, you can add delete theItem on a new line after set the end of theList to the location of theItem.

If you want to avoid redownloading, you'll have to manually change the iTunes U download settings (although I'm not sure if iTunes will actually redownload an item that has been deleted - typically it only downloads new items).

Be sure to change the path to the destination folder to your desired destination, on the set theDestination … line. It must be a folder that exists already.


Script

tell application "iTunes"
    set theList to {}
    set iTunesU to tracks of playlist "iTunes U"
    repeat with theItem in iTunesU
        try
            if played count of theItem &gt; 0 then
                set the end of theList to the location of theItem
            end if
        end try
    end repeat
end tell

tell application "Finder"
    set theDestination to POSIX file "/Users/rob/Desktop/test/"
    repeat with theFile in theList
        move theFile to theDestination
    end repeat
end tell