in reply to Re: copy files on sftp to local dir and delete copied file
in thread copy files on sftp to local dir and delete copied file

Hello

that seems to work

I needed to change the ls because it was still crashing due to . and .. directories.

so I set like this:

my @files = @{ $sftp->ls(no_wanted => qr/^\./)

this seems to work okay..

thanks alot.

Replies are listed 'Best First'.
Re^3: copy files on sftp to local dir and delete copied file
by MidLifeXis (Monsignor) on Sep 24, 2015 at 13:22 UTC

    Are you sure you want to eliminate anything that begins with '.' (just asking, you very well might)? If not, it would likely be better to explicitly call out '.' and '..'.

    You may also want to consider what you mean by success. For example, are you certain the remote side is not being written to? There is a race condition between the get and the remove calls. OTOH, if the source location is unchanging (other than this script), you may be just fine.

    --MidLifeXis