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; } } } } #### Checking C:\Documents and Settings\Alan\My Documents\My Pictures Opening C:\Documents and Settings\Alan\My Documents\My Pictures Open fail Invalid argument -- shouldn't happen -- ignoring... Checking D:\Documents and Settings\Alan\My Documents\My Pictures Checking E:\Documents and Settings\Alan\My Documents\My Pictures Checking F:\Documents and Settings\Alan\My Documents\My Pictures Checking G:\Documents and Settings\Alan\My Documents\My Pictures Checking H:\Documents and Settings\Alan\My Documents\My Pictures Checking I:\Documents and Settings\Alan\My Documents\My Pictures Opening I:\Documents and Settings\Alan\My Documents\My Pictures I:\Documents and Settings\Alan\My Documents\My Pictures 480 Pic stuff at I:\Documents and Settings\Alan\My Documents\My Pictures #### Summary of my perl5 (revision 5 version 18 subversion 1) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread-64int uname='Win32 strawberry-perl 5.18.1.1 #1 Tue Aug 13 19:20:13 2013 i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fno-strict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.7.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"' libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl518.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Aug 13 2013 19:29:16 @INC: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .