in Perl find call looking to exclude folder and ignore duplicate finds.
in Perl find call looking to exclude folder and ignore duplicate finds.
(OP)
hello community out there,
new to Perl word!
here is the find section in perl script
##########################################################
my $processed_files = 0;
find({ wanted => sub {
save_file($File::Find::name)
if -f $_
&& $_ =~ /auth\.log$/ },
follow => 1 },
@ARGV
);
##########################################################
During the find process in above section, how to exclude directory /data/logs/master during search process and also ignore duplicate finds.
Is the below way correct:
#######################################################################################################
find(
{
wanted => sub {
save_file($File::Find::name)
if -f $_
&& $_ =~ /auth\.log$/
&& $File::Find::dir ne '/data/logs/master'; # exclude /data/logs/master
},
follow => 1
},
@ARGV
####################################################################################################
thanks in advance!
new to Perl word!
here is the find section in perl script
##########################################################
my $processed_files = 0;
find({ wanted => sub {
save_file($File::Find::name)
if -f $_
&& $_ =~ /auth\.log$/ },
follow => 1 },
@ARGV
);
##########################################################
During the find process in above section, how to exclude directory /data/logs/master during search process and also ignore duplicate finds.
Is the below way correct:
#######################################################################################################
find(
{
wanted => sub {
save_file($File::Find::name)
if -f $_
&& $_ =~ /auth\.log$/
&& $File::Find::dir ne '/data/logs/master'; # exclude /data/logs/master
},
follow => 1
},
@ARGV
####################################################################################################
thanks in advance!
RE: in Perl find call looking to exclude folder and ignore duplicate finds.
If you are still looking, what would be the duplicates that you want to exclude? Would it just be filenames that are duplicated or some portion of the path, or something else?
RE: in Perl find call looking to exclude folder and ignore duplicate finds.
during the file check this folder should be excluded data/logs/master.
And the folder or files which is already seen not check it again.