shilpam has asked for the wisdom of the Perl Monks concerning the following question:

I SFTP to a remote server. And I need to know if a particular file is present on the remote server or not. If it is present, then I need to get it to my local server. I am using Net::SFTP. Is there any way to find whether a file is present on remote server or not?
  • Comment on How to find whether a file is present on remote server?

Replies are listed 'Best First'.
Re: How to find whether a file is present on remote server?
by McDarren (Abbot) on Feb 28, 2006 at 09:14 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: How to find whether a file is present on remote server?
by zentara (Cardinal) on Feb 28, 2006 at 13:29 UTC
    Just a tip. You don't show any code, but one thing to watch out for when using sftp, is that it usually requires the filenames to be full names, including their path, "$full_path_dir/$file". So remember that, if you see weird errors where files are not found or cannot be moved, yet you know they are there.

    I'm not really a human, but I play one on earth. flash japh
Re: How to find whether a file is present on remote server?
by Anonymous Monk on Feb 28, 2006 at 20:45 UTC
    Why do you need to check if it's there? Just try to 'get' it and handle the case where that fails, meaning it's not found.