in reply to Re^15: transfer a file via SFTP
in thread transfer a file via SFTP

THX a lot, it works excellent now.

greetings

Replies are listed 'Best First'.
Re^17: transfer a file via SFTP
by ig (Vicar) on Aug 02, 2009 at 02:34 UTC

    Great!!

    You should be able to move the setup of the sftp connection outside (before) the loop. One connection should suffice to transfer several files.

    When you move the log file within the loop, the first time it will work but after that the file isn't there. If you want a separate log file for each file processed then you should probably set this up separately for each file within the loop.

      This script looks every 5 minutes for a .txt file.
      I'd like to die the script if .txt file is not there, otherwise it creates a lot of backup directories.
      Can u pls help me to change it?

        You could add

        die unless(-e $file);

        There are many file tests available. You can read about them in -X.