Re: if file exists script
Re: if file exists script
- Subject: Re: if file exists script
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 17 Sep 2005 09:22:56 -0400
The Finder has a Boolean function "exists" that returns true if the
file or folder is there, false otherwise.
But exists requires a Finder file or alias object, and by the time you
do the necessary coercions, there's an easier way that doesn't even
require the Finder's involvement. It's based on the fact that
coercion to "alias" will only succeed if the file exists. So:
on fileExists(f)
try
f as string as alias
return true
on error
return false
end try
end
Then you can just use
if fileExists(...)
or, to avoid any potential name conflicts,
if my fileExists(...)
anywhere you want to do the test.
On 9/17/05, Bob Cuilla <email@hidden> wrote:
> I need a very simple script to return true or false for the existence
> of a finder file. I am calling the script from Filemaker before
> creating a same-named file
>
> can you help?
>
> Bob
>
>
> _______________________________________________
> 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
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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