Perhaps someone out there can tell me what is wrong with this. The first if statement works fine but the second one does not.
--Creates Investors Toolbox Folder
tell application "Finder"
if not (exists folder "Investors Toolbox" of (path to documents folder)) then
make new folder at (path to documents folder) with properties {name:"Investors Toolbox"}
end if
--Creates eValuator Folder Within Investors Toolbox Folder
if not (exists folder "eValuator" of (path to documents folder) & "Investors Toolbox") then
make new folder at (path to documents folder) & "Investors Toolbox" with properties {name:"eValuator"}
end if
end tell
in the second statement you use a wrong syntax to specify the folder or path.
I would write it like this
--Creates Investors Toolbox Folder
try
set InvToolboxFolder to ((path to documents folder as Unicode text) & "Investors ToolBox") as alias
on error
tell application "Finder" to set InvToolboxFolder to make new folder at (path to documents folder) with properties {name:"Investors Toolbox"}
end try
--Creates eValuator Folder Within Investors Toolbox Folder
tell application "Finder"
if not (exists folder "eValuator" of InvToolboxFolder) then make new folder at InvToolboxFolder with properties {name:"eValuator"}
end tell
Like so, perhaps: (oops, Stefan got there first ;))
tell application "Finder"
set D to path to documents folder as Unicode text
--Creates Investors Toolbox Folder
if not (exists (D & "Investors Toolbox:")) then make new folder at D with properties {name:"Investors Toolbox"}
--Creates eValuator Folder Within Investors Toolbox Folder
if not (exists (D & "Investors Toolbox:eValuator")) then make new folder at (D & "Investors Toolbox") with properties {name:"eValuator"}
end tell
You can use a shell script and the mkdir command to eliminate the need for recursive routines to create folders…
set evaluatorDir to ((POSIX path of (path to documents folder)) & "Investors Toolbox/eValuator") as string
do shell script "mkdir -p '" & evaluatorDir & "'"