in reply to Re: filtering hidden files on Win32
in thread filtering hidden files on Win32

When writing a fire-and-forget duplicates finder just now, I found this thread very useful. My coding style and approach seems rather different though. But whether low code granularity is good is often a highly debated issue.
sub dfind { my ($dref, $top) = @_; hidden( $top ) and return; if (-d $top) { for my $file (glob( "$top/*" )) { dfind( $dref, $file ); } } else { register( $dref, $top ); # add to HoA } } sub hidden { my $file = shift; my $attribs; Win32::File::GetAttributes($file, $attribs); return $attribs & HIDDEN; }
Update: note that hidden directories and files are both filtered out owing to how the recursion is contructed.