Re: (no subject)
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. |
----------------------------------------------------------------------