• 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: check if a folder exists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check if a folder exists


  • Subject: Re: check if a folder exists
  • From: JollyRoger <email@hidden>
  • Date: Wed, 08 May 2002 21:59:43 -0500

On 5/8/2002 12:35 PM, "Mark Oglesby" <email@hidden> wrote:

> Can anyone give me an example of an if -then -else
> statement that would check to see if a folder exists in
> the finder.

This is the best method I've found to date - I use it in hundreds of my
scripts:

-- begin script
on FileExists(someFile)
try
set anAlias to (someFile as alias)
return true
on error
return false
end try
end FileExists
-- end script

Use it like this:

-- begin script
set testFile to (the path to the startup disk as text) & "Development:"
if my FileExists(testFile) then
display dialog "The folder exists."
else
display dialog "The folder does not exist."
end if
-- end script

HTH

JR
_______________________________________________
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: 
 >check if a folder exists (From: Mark Oglesby <email@hidden>)

  • Prev by Date: Quark Boxes
  • Next by Date: Re: check if a folder exists
  • Previous by thread: Re: check if a folder exists
  • Next by thread: Re: check if a folder exists
  • Index(es):
    • Date
    • Thread