AppleScript scripts
Automate routine and time consuming tasks with the powerful programming language built into every Mac. These are a few useful routines. Copy and paste the code into AppleScript Editor, edit it if necessary, save it to the appropriate location, and attach it to your folder.*
Rename file extension (Folder Action)
Attach this script as a folder action to rename the file extension of files added to the folder. Open the script, edit the properties at the top of the script to enter the extension to look for and the resulting extension to change it to. Save the script to the Folder Action Scripts folder and then attach it to the folder. Everything after that is automatic. If necessary, the script renames files, starting with the base file name, to unique file names to avoiding overwriting files. Optionally place the renamed and original files into separate sub-folders and open the renamed file with its default application.
Examples:
This folder action is attached to the browser’s Downloads folder to change show_temp.pl files to show_temp.pdf and open the renamed file in the PDF viewer.
File downloaded: show_temp.pl is renamed to show_temp.pdf.
File downloaded: show_temp-1.pl is renamed to show_temp-1.1.pdf (when there is a preexisting show_temp-1.pdf).