A script to remove Real Player's .RAM files

Feb 02, '04 08:29:00PM

Contributed by: pinocchio

I got tired of having my desktop filled with tiny Real Player files left behind everytime I watch NasaTV. I decided to solve the problem using Folder Actions. I wrote a small AppleScript, which I added to my Desktop Folder as a folder action. Everytime a .ram file is copied onto the Desktop, the script waits 10 seconds and then it moves the file to the trash. The 10 second delay is necessary so Real Player has time to read the file. Here's the script:


on adding folder items to this_folder after receiving added_items
  try
    repeat with i from 1 to number of items in added_items
      set this_item to item i of added_items
      set the item_info to info for this_item
      if the name extension of the item_info is in {"ram"} then
        do shell script "sleep 10"
        tell application "Finder"
          move this_item to trash
        end tell
      end if
    end repeat
  end try
end adding folder items to
This script can be extended to remove other annying files from similar applications. Just add their extension in the curly brackets that now contain {"ram"}.

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040125051931304