• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to Test for a file ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >How to Test for a file ... (From: Charles Heizer <email@hidden>)

  • Prev by Date: How to Test for a file ...
  • Next by Date: Re: How to Test for a file ...
  • Previous by thread: How to Test for a file ...
  • Next by thread: Re: How to Test for a file ...
  • Index(es):
    • Date
    • Thread