in reply to Re^4: how to handle the warnings in a find statement
in thread how to handle the warnings in a find statement
Wow
Im not sure you realize that the "wanted" sub gets passed directories too. i often have a return unless (-f $file); in there.
another thing the wanted sub can do is signal to prune the tree. $File::Find::prune = 1 is a signal to File::Find not to follow a directory. You want to prune junction points.
now you may even be able to contrive a test <.. some code to see if its a junction ..> that does not require "use Win32::LongPath", i dont know what it is now. Otherwise i think you are stuck trying to install that module. , sorry# this test for directory $stat->{mode} & S_IFDIR ? print "Directory\n" : print "File\n" +; # is the same as this one $stat->{attribs} & FILE_ATTRIBUTE_DIRECTORY ? print "Directory +\n" : print "File\n"; my $isjunction= <.. some code to see if its a junction ..> ; if ($isjunction){ $File::Find::prune = 1 return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: how to handle the warnings in a find statement
by huck (Prior) on Dec 20, 2016 at 10:13 UTC | |
|
Re^6: how to handle the warnings in a find statement
by Aldebaran (Curate) on Dec 21, 2016 at 05:55 UTC | |
by beech (Parson) on Dec 21, 2016 at 08:23 UTC |