#!/usr/bin/perl use warnings; use 5.016; ## File::Find for windows, handling junctions ## https://perlmonks.org/?node_id=11104464 use File::Find; use Cwd; ## https://metacpan.org/pod/Win32API::File use Win32API::File qw'GetFileAttributes :FILE_ATTRIBUTE_'; use File::Basename; my $current = cwd; my $VERBOSE = 1; find( \&pm_beneath, $current, ); say "--------------"; find( \&pm_beneath, "C:/Strawberry", ); sub isjunc { return GetFileAttributes( $_[0] ) & FILE_ATTRIBUTE_REPARSE_POINT; } sub pm_beneath { if (-d) { # junctions show up as TRUE for `-d` if ( isjunc($File::Find::name) ) { # if junction, don't bother creating checking destination directory existence, # and don't try to recurse into it $File::Find::prune = 1; printf( "[%s] %-12s'%s'\n", scalar(localtime), "JUNCTION:", $File::Find::name ) if ($VERBOSE); return; } } my $basename = basename($File::Find::name); return unless $basename =~ /\.pm$/; print "$File::Find::name\n"; my $access_age = -A $basename; print " $basename\n"; printf "access age in days: %.2f\n", $access_age; } __END__