Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
PerlMonks  

(ichi) Re: File::Find

by ichimunki (Priest)
on Jun 07, 2002 at 18:18 UTC ( #172602=note: print w/ replies, xml ) Need Help??


in reply to File::Find

CPAN is your friend here. You want the Win32::DriveInfo module. Otherwise the root ('/' not '../', btw) of each drive volume is separate: C:, D:, etc. (enclosed sample code untested)

use File::Find; use Win32::DriveInfo; for( Win32::DriveInfo::DrivesInUse ) { find( \&handleFind, "$_:" ); } sub handleFind {... same as before ...}
UPDATE: Correct error in use of drive letter ':' is required

Note: installing Win32::DriveInfo requires installing Win32::API. The former is available only from CPAN, the latter is available as a PPM. Fortunately Win32::Drive info is pure Perl and can simply be copied to C:/perl/lib/site/lib/win32 and used from there.


Comment on (ichi) Re: File::Find
Download Code
Re: (ichi) Re: File::Find
by Util (Priest) on Jun 10, 2002 at 03:16 UTC
    I agree, Win32::DriveInfo is best.
    As we just discussed here, this code also works:
    use File::Find; use Win32API::File qw( :Func :DRIVE_ ); my @drives = map { tr{\\}{/}s; $_ } grep { GetDriveType($_) == DRIVE_FIXED } getLogicalDrives(); find( sub { $File::Find::prune = 1, return if $File::Find::name =~ m{^.:/System Volume Information$}; print "$_\n"; }, @drives );
    Perhaps someone will find it useful when Win32API::File is at hand, but Win32::DriveInfo is not.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://172602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-04-20 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls