Sample Header Ad - 728x90

How can I install this script as a folder action?

4 votes
1 answer
969 views
I'm trying to setup a script as a folder action that will identify and change unwanted characters in the name of a file added to a target folder. The intent is to have this automation run as a folder action that should read the name of an incoming file or new folder, check for spaces and dashes, and replace them with underscores. Here is what I have so far: on adding folder items to theFolder after receiving theNewItems repeat with i from 1 to count of theNewItems set thisItem to item i of theNewItems tell application "Finder" set FileName to name of thisItem end tell end repeat set AppleScript's text item delimiters to {space, "-"} set FileName to the FileName's text items set AppleScript's text item delimiters to "_" set FileName to the FileName as text end adding folder items to How can I install this script as a folder action?
Asked by branarama (53 rep)
Oct 8, 2018, 08:37 PM
Last activity: Oct 9, 2018, 10:12 AM