in reply to user net:openSSH and File::find::Rule together.
my $out = $ssh->capture({stdin_data => <<'EOS'}, '/usr/bin/perl'); # Your remote script goes here: use File::Find::Rule; use POSIX qw(strftime); ... EOS
Probably this method is going to be slower than the others as running a find operation over SFTP does lots of network roundtrips, but on the other hand you don't depend on having perl there, in some known place or programming for an antediluvian Perl version.my $sftp = $ssh->sftp; my $now = time; my @files = $sftp->find("/mypath", wanted => sub { my $e = $_[1]; $e->{filename} =~ /\.0$/ or return; $e->{a}->mtime + 3600 >= $now or return; 1 });
Update: The capture method call was wrong. Corrected!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: user net:openSSH and File::find::Rule together.
by garcimo (Novice) on Feb 15, 2018 at 17:12 UTC | |
by salva (Canon) on Feb 15, 2018 at 17:16 UTC | |
by garcimo (Novice) on Feb 15, 2018 at 18:34 UTC | |
by salva (Canon) on Feb 15, 2018 at 18:39 UTC |