[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Using -e file test



I have a script that copies a file from one directory to another and in
order to use FSpFileCopy, I have the script check first to see if the file
already exists and then use FSpDelete to delete it first. The following
script returns 'file not found' error rather than skipping past the block
if the file does not already exist in the new location but works fine if
the file already exists:

$filepath = "HD:somefile.txt"; #place where the file is to be copied to
if (-e, "$filepath") {
    FSpDelete("$filepath") or warn $^E;
}

Am I doing something wrong (or is there a better way to do this?)?

Thanks for your help,
Kevin Johnson



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch