Re: if not (exists folder .......
Re: if not (exists folder .......
- Subject: Re: if not (exists folder .......
- From: Michelle Steiner <email@hidden>
- Date: Sun, 10 Jul 2005 17:01:10 -0700
On Jul 10, 2005, at 4:35 PM, Dustin Bell wrote:
I have a script that has the following in it. What I would like to
know is how do I write the if not (exists folder.... command line
so the script will continue even if all 5 folders are there?
set the_folders to {"ASection", "BSection", "CSection", "DSection",
"ESection"} as list
repeat with i from 1 to number of items in the_folders
make new folder at folder theDay of folder theInput of
disk "PDF Archives" with properties {name:item i of the_folders}
end repeat
This will work. Since your example didn't define theDay and
theInput, I used literals to represent them, but that would be an
easy editing job for you to fix. I also simplified the path for
easier reading.
-- Michelle
set the_folders to {"ASection", "BSection", "CSection", "DSection",
"ESection"} as list
set thePath to (path to startup disk as text) & "theInput:" & "theDay:"
repeat with i from 1 to number of items in the_folders
tell application "Finder"
if not (exists (folder (thePath & item i of the_folders))) then
make new folder at folder thePath with properties
{name:item i of the_folders}
end if
end tell
end repeat
--
We are like tenant farmers chopping down the fence around our house
for fuel when we should be using nature's inexhaustible sources of
energy - sun, wind and tide. I'd put my money on the sun and solar
energy. What a source of power! I hope we don't have to wait until
oil and coal run out before we tackle that.
-- Thomas Alva Edison (1847-1931)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden