• 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: Checking on the existence of a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking on the existence of a file


  • Subject: Re: Checking on the existence of a file
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 24 Oct 2012 12:30:37 -0500

On Oct 24, 2012, at 11:55 AM, Eric Robertson wrote:

I thought I could use 'exists' to find out if the file I wanted to use was already there but I couldn't find out how to do this. Instead I decided just to use 'try' and 'on error' when I was producing the alias to the file I wanted to use.

Here are some examples of code I use:

1. invisibleTagArchive is a string which begins with "." (an invisible item)
    and locCont is an alias to a folder (but notice that I used it as text).

tell application "System Events" to exists disk item invisibleTagArchive of disk item (locCont as text)

2. destFolder is an alias to a folder and the name of the file is a string.

tell application "Finder"
.
.
if not (exists file (newFileName & "." & suffixNr & ".emlx") of destFolder) then exit repeat

3. Here, Path is the full path to a folder as text.

tell application "Finder"
if not (exists folder Path) then return 0

4. newFileName is a string and destFolder is an alias

tell application "Finder"
if (exists folder newFileName of destFolder) then

These have been working correctly for a very long time in 10.6.8 and continue to work in 10.7.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Checking on the existence of a file (From: Eric Robertson <email@hidden>)

  • Prev by Date: Re: Checking on the existence of a file
  • Next by Date: Re: Checking on the existence of a file
  • Previous by thread: Re: Checking on the existence of a file
  • Next by thread: Re: Checking on the existence of a file
  • Index(es):
    • Date
    • Thread