Rename File Extension (AppleScript Folder Action)

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).


* In the AppleScript Editor, use usual text editing commands to change the property values you want changed and save the file to the path: “[Hard Disk]:Library:Scripts:Folder Action Scripts:”. Control-click the folder on which you wish to attach the folder action and choose Folder Action Setup from the contextual menu. Select your saved folder action script and check the Enable Folder Actions check box. Close the Folder Action Setup window and test your setup by adding a file to the folder on which you have attached the action.

This entry was posted in Applescript, Folder Action, Software and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>