Ned Cunningham wrote:
>Please help.
>
>I need to check if a files exists in the root of c. I would like to use if
>else to control the response. I have tried to check the file and verify $!,
>but it seems to give me a problem.
>
>Can anyone help?
>
>..
>
Use -e operator:
if(-e $file){
On Mon, 4 Feb 2002, Ned Cunningham wrote:
> I need to check if a files exists in the root of c. I would like to use if
> else to control the response. I have tried to check the file and verify $!,
> but it seems to give me a problem.
The -e operator can test for the existance of a file:
if(-e
$file = "/path/to/file.txt";
if (-e $file) {
print "Yep, that file exists\n";
} else {
print "Nope. Not there\n";
}
For more on the file test operators see perldoc -f -X
HTH
John
-Original Message-
From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
Sent: 04 February 200
if (-e $file) do something
[EMAIL PROTECTED] wrote:
>
> How would I check if a certain file exists in a certain directory?
>
> I'm already using File::Find to process a bunch of mp3's, and before I
> move/copy them to a different folder, I want to check if the file already
> exists.
>
> --
> T
Thursday, November 22, 2001, 2:19:16 PM, [EMAIL PROTECTED] wrote:
GFFC> How would I check if a certain file exists in a certain directory?
GFFC> I'm already using File::Find to process a bunch of mp3's, and before I
GFFC> move/copy them to a different folder, I want to check if the file already