• 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: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


  • Subject: Re: (no subject)
  • From: Michelle Steiner <email@hidden>
  • Date: Thu, 25 Oct 2001 23:10:03 -0700

On 10/25/01 12:29 PM, Arthur Cormack <email@hidden> wrote:

> i have created a droplet that renames files - server log files,
>based on the dates of the logs in them - and it works quite nicely
>... except for when there is/would be a duplicate filename made ...
>i need to pre-empt this conflict by checking to see if a file by the
>name of the name that we would call the logfile that we are currently
>working with exists. And ... if it does ... add a suffix integer to
>the filename which indicates which duplication number it is. It will
>also check for multiple duplicates by looking at the integer as well.
>There is one obstacle that I am having trouble with. How do I check
>to see whether or not a file exists?

One way is to reference it as an alias inside a try statement.

if it exists, it won't generate an error, so the code for handing
existing files can go right after that statement; if it does not exist,
it will generate an error, so the code that handles non-existing files
can go in the "on error" portion.

--Michelle

----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------


  • Prev by Date: Re: any way to tell if a script has a 'return' statement?
  • Next by Date: MP3 id3 tag info in AppleScript?
  • Previous by thread: Re: (no subject)
  • Next by thread: ANNOUNCE: JavaScript for OSA 1.0
  • Index(es):
    • Date
    • Thread