Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

in Perl find call looking to exclude folder and ignore duplicate finds.

Status
Not open for further replies.

ss_ham

Systems Engineer
Apr 18, 2023
2
AT
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!




 
Hey there, not sure if you're still looking for solutions since this is from a couple weeks ago.

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?
 
@rharsh
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top