Hmmmm… How do I get this to work?
I want to run a Finder loop so ideally the script would work in this way.
tell application "Finder"
set todays_date to (current date) as text
display dialog todays_date
make new folder at folder "Desktop" of folder "benhalsall" of folder "Users" of disk "Macintosh HD" with properties {name:(todays_date)}
end tell
Hi benhalsall,
The date string contains characters which are not allowed in Mac file names (e.g. the colons in the time part), that’s why your script throws an exception. So this might be a better solution for you:
tell application "Finder"
set timestamp to do shell script "/bin/date +%Y%m%d"
make new folder at folder "Desktop" of folder "benhalsall" of folder "Users" of disk "Macintosh HD" with properties {name:timestamp}
end tell
Hey Martin,
Thanks for that.
In the end I used this: -
tell application "Finder"
set timestamp to do shell script "/bin/date +%Y-%m-%d-%H.%M.%S"
make new folder at folder "Desktop" of folder "benhalsall" of folder "Users" of disk "Macintosh HD" with properties {name:timestamp}
end tell
As I wanted to include the hours, minutes and seconds. But thanks to you pointing me in the right direction.
Ben