Re: File exists on a posix path
Re: File exists on a posix path
- Subject: Re: File exists on a posix path
- From: Gnarlodious <email@hidden>
- Date: Fri, 10 Feb 2006 12:45:00 -0700
- Thread-topic: File exists on a posix path
I think what you mean is this:
do shell script "ls ~/testfile"
Unfortunately if testfile does not exists then Applescript errors. I believe
this situation started in 10.4, because before then it returned a nul
string. But regardless, you now need to wrap it in a try statement:
try
do shell script "ls ~/testfile"
on error
return ""
end try
or some such gyration. I wish Apple would fix it, but it won't happen since
I didn't complain about it.
-- Gnarlie
Entity Charles E. Heizer spoke thus:
> Hello,
> I really don't use Applescript very offten but I have a need right
> now. I would like to know how to do a file exists on a posix file
> example:
> set y to "/usr/sbin/installer"
> set a to POSIX file y
> if (the file a exists) then
> display dialog " already exists"
> end if
> Thanks!
> - charles
> _______________________________________________
_______________________________________________
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