perl ftp check file exists

I have a perl script that ftp's to an NT server, checks if the file is growing, gets the file, does some more size checking after the get on the unix box. My question, is there a good way to check if the file exists on the NT when I know the exact file to check for? I thought about doing an "ls file.dat" and passing the return code to a variable and then checking the varible, but that seems kinda messay. Thanks in advance for any suggestions.

You could try something like this:

if (-f 'c:\\location_to_file\\filename') {
        # code necessary
}

you MUST use double "\" (e.g. "\\") to symbolise a single "\" - only 'cos it's on a Windows computer

:slight_smile: me likes Perl :stuck_out_tongue:

Thanks for the info. I came up with this as I continued to pound away at it.

next if (($fsize = $ftp->size($ntfile)) == undef);

I have to check the file size anyway, if the file does not exists return value of size is undefined. The "next" is used to take me back to the previous loop before executing any commands that may follow this statement.