Re: How to Test for a file ...
Re: How to Test for a file ...
- Subject: Re: How to Test for a file ...
- From: Roger Howard <email@hidden>
- Date: Wed, 30 Jun 2004 13:55:02 -0700
On Jun 30, 2004, at 1:24 PM, Charles Heizer wrote:
Hello,
I was wondering if anyone could tell me how to test if a file exists?
So, if it does not I can create the file.
if you have a Finder reference of some kind:
tell application "Finder" to exists file FileName of...
or if you've got a path of some kind (this is how I usually do it)
coerce it to an alias... if it succeeds, the file exists, if not then
it doesn't... use a try...end try block to trap for the error if it
doesn't exist:
try
thePath as string as alias
return true
on error
return false
end
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.