sub FindPicDrive { foreach (Win32::DriveInfo::DrivesInUse()) { my $tmp = $_ . ":\\Documents and Settings\\Alan\\My Documents\\My Pictures"; # Must also find several directories matching the pattern m[^\d{4}_\d{2}_\d{2}$] print "Checking $tmp\n"; if (-d $tmp) { print "Opening $tmp\n"; eval { opendir DH, $tmp or die "This shouldn't happen: $!\n"; }; if ($@) { print "Open fail $! -- shouldn't happen -- ignoring...\n"; next; } my $count; my @picdirs = grep /^\d{4}_\d{2}_\d{2}$/, readdir DH; #print join(', ',@picdirs), "\n"; closedir DH; if (@picdirs > 5) { print $tmp, ' ', scalar(@picdirs), "\n"; return $tmp; } } } }