'Loop happens when trying to add string to a filename via AppleScript
I am trying to write an AppleScript that can add the current time to a folder's name.
on adding folder items to this_folder after receiving these_items
repeat with this_item in these_items
tell application "Finder"
set t to (time string of (current date))
set name of this_item to (t & " " & (name of this_item))
end tell
end repeat
end adding folder items to
I have added the script as a Folder Action for a specific folder so it will automatically rename every folder that is being put into it. But when I add a folder to the one with the script as a Folder Action the time is being added repeatedly until the folder's name is too long to add more characters to it. How can I make it so the time is only being added once?
Thank you in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
