in reply to Perl sftp behavior when there are no files in the share

Bindo:

Rather than use die, just print the error and return from get_LOGS to let the program try to get the next logfile.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Perl sftp behavior when there are no files in the share

Replies are listed 'Best First'.
Re^2: Perl sftp behavior when there are no files in the share
by Bindo (Acolyte) on Mar 21, 2013 at 12:50 UTC

    Thank you sir Robotics

    Even though it solves my problem mind you that I have a print statements just after when the sub "get_LOGS" is called.

    get_LOGS("172.25.70.221","abc","abc123","/x01/INT/abc/vim",$GETL); print "File \"$GETL\" downloaded to ==> \"$LOGS_LOCAL +_PATH$TODAY\"\n\n";

    so the script return the following output

    Connecting to the sftp share! Please wait....! OK. On the share! Downloading the file "mmm"...................!

    File does not seem to be present on the remote share. Please re-request..!!! Couldn't stat remote file: No such fileFile "mmm" downloaded to ==> "/x02/abc/abcd/20130321"

    Dont I need condition in my "get_LOGS" perhaps after the following line? Could you please try to write that for me?

    $sftp->get($REM_FILE) or print "File does not seem to be present on the remote share. Please re-request..!!!\n" . $sftp->error\n;
      You should print your confirmation message from within get_LOGS, like this:
      if $sftp->get($REM_FILE) print "file '$REM_FILE' downloaded\n" else print "File does not seem to be present on the remote share. Pleas +e re-request..!!!\n" . $sftp->error\n;

        oh looks lke that's what I wanted sir. How come I haven't seen it? You wouldn't believe the time I wasted on this. Thank you very much sir. I will confirm once I try it out probably in another couple of hours.

        /Bindo

        Mr Soonix you are a life saver. It indeed did the trick :) thank you very much. And thanks all whoever have been trying to help.

        I have one last question pertaining to this thread though. Could someone help me understand how to display the progress when a download is in place. I dont want to install another cspan module to reach this. IF I could just get the progress shown in the screen when you download a file manually is more than sufficient. I think what im asking here is how to print the STDOUT to the screen.Please try to help