in reply to Re^3: scp output without having to use "Net::SCP" in Perl
in thread scp output without having to use "Net::SCP" in Perl

Let's try this again, I do a ssh over to a host, and grab certain files from /tmp, this works fine, I then want to send these logs to a second host. my @OUTPUT = `ssh $USER\@$host ls -ltr /tmp | grep logs`; foreach my $output (@OUTPUT) { chomp ($output); system("/usr/bin/scp", "--", $output, "user\@host:/home/user/logs"; } I now get "No such file or directory", so your right, I need to put the log itself into a file, any ideas or should I use a different approach? Thanks, -- pjzero@90
  • Comment on Re^4: scp output without having to use "Net::SCP" in Perl

Replies are listed 'Best First'.
Re^5: scp output without having to use "Net::SCP" in Perl
by GotToBTru (Prior) on Jun 04, 2015 at 14:59 UTC

    Have you read all the advice you have been given? Your ls -ltr command is returning all sorts of information: file privileges, file owner, size, modification date, file name. I don't think you want or need all that, and scp certainly is confused by it. Use ls -1tr instead. It will return the file name only.

    Dum Spiro Spero