Fix #5388
This commit is contained in:
parent
b40fc2590e
commit
6cbb625ff0
|
@ -172,7 +172,7 @@ Need Perl 'Net::FTPSSL' module
|
|||
=item B<--ftp-options>
|
||||
|
||||
Add custom ftp options.
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||
|
||||
=item B<--username>
|
||||
|
||||
|
|
|
@ -98,7 +98,11 @@ sub run {
|
|||
|
||||
apps::protocols::ftp::lib::ftp::connect($self);
|
||||
my $current_time = time();
|
||||
foreach my $dir (@{$self->{option_results}->{directory}}) {
|
||||
my $dirs = ['.'];
|
||||
if (defined($self->{option_results}->{directory}) && scalar(@{$self->{option_results}->{directory}}) != 0) {
|
||||
$dirs = $self->{option_results}->{directory};
|
||||
}
|
||||
foreach my $dir (@$dirs) {
|
||||
my @files;
|
||||
|
||||
if (!(@files = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{ls}->{$self->{ssl_or_not}}->{name}, command_args => [$dir]))) {
|
||||
|
@ -113,7 +117,7 @@ sub run {
|
|||
my $time_result;
|
||||
|
||||
if (!($time_result = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name}, command_args => [$file]))) {
|
||||
# Surely a directory. So we go forward. Can't get time for that.
|
||||
# Sometime we can't have mtime for a directory
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -184,7 +188,7 @@ Need Perl 'Net::FTPSSL' module
|
|||
=item B<--ftp-options>
|
||||
|
||||
Add custom ftp options.
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||
|
||||
=item B<--username>
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ use File::Basename;
|
|||
|
||||
# How much arguments i need and commands manages
|
||||
my %map_commands = (
|
||||
mdtm => { ssl => { name => '_mdtm' }, nossl => { name => 'mdtm' } },
|
||||
ls => { ssl => { name => 'nlst' }, nossl => { name => 'ls'} },
|
||||
ls => { ssl => { name => 'list' }, nossl => { name => 'dir'} },
|
||||
);
|
||||
|
||||
sub new {
|
||||
|
@ -144,8 +143,12 @@ sub countFiles {
|
|||
next;
|
||||
}
|
||||
|
||||
foreach my $file (@files) {
|
||||
my $name = $dir . '/' . basename($file);
|
||||
foreach my $line (@files) {
|
||||
next if ($line !~ /(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(.*)/);
|
||||
my ($rights, $filename) = ($1, $2);
|
||||
my $bname = basename($filename);
|
||||
next if ($bname eq '.' || $bname eq '..');
|
||||
my $name = $dir . '/' . $bname;
|
||||
|
||||
if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' &&
|
||||
$name !~ /$self->{option_results}->{filter_file}/) {
|
||||
|
@ -153,9 +156,7 @@ sub countFiles {
|
|||
next;
|
||||
}
|
||||
|
||||
if (!(my $time_result = apps::protocols::ftp::lib::ftp::execute($self,
|
||||
command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name},
|
||||
command_args => [$name]))) {
|
||||
if ($rights =~ /^d/i) {
|
||||
if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) {
|
||||
push @$list, { name => $name, level => $level + 1};
|
||||
}
|
||||
|
@ -163,7 +164,7 @@ sub countFiles {
|
|||
$self->{output}->output_add(long_msg => sprintf("Match '%s'", $name));
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
|
@ -195,7 +196,7 @@ Need Perl 'Net::FTPSSL' module
|
|||
=item B<--ftp-options>
|
||||
|
||||
Add custom ftp options.
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||
|
||||
=item B<--username>
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ Need Perl 'Net::FTPSSL' module
|
|||
=item B<--ftp-options>
|
||||
|
||||
Add custom ftp options.
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||
|
||||
=item B<--username>
|
||||
|
||||
|
|
Loading…
Reference in New Issue