AppleScript to find and delete a folder inside an FCPX library

applescriptautomatorfinderscript

I need to write or find a simple script to find, select and move to trash, folders within a Final Cut Pro X library. Because these libraries are bundles you can't search them in the normal way.

What I want is a script that runs every day, searches the libraries finds Folders (and their contents) called "Render Files" and then moves them to trash.

I can use automator to find the bundles, and to list the contents, but then I cannot get it to select only the 'Render Files' folders.

Best Answer

Add the following to your crontab (env EDITOR=nano crontab -e):

@daily /usr/bin/find /path/to/fcplibraries -name "Render Files" -type d -delete

Keep backups and make sure you've got the right path.