day, April 18, 2005 5:26 AM
> To: Robert Maxwell
> Cc: ActivePerl@listserv.activestate.com
> Subject: Re: How to build a list of files on a drive...
>
> Robert Maxwell wrote:
>
>
>>Here's a newbie question I guess. How would I build a list of all
>>files on
From: John Maliniak [mailto:[EMAIL PROTECTED]
>
> From: [EMAIL PROTECTED]
> >
> > use strict;
> > use File::Find;
> >
> > my $dir = shift || "C:/";
> > print "$dir: \n";
> > find (\&wanted, $dir);
> >
> > sub wanted {
> >
> > return if /^\.{1,2}$/;
> > print "$File::Find::name: \n" if -d;
> >
@listserv.activestate.com
Subject: Re: How to build a list of files on a drive...
Robert Maxwell wrote:
> Here's a newbie question I guess. How would I build a list of all
> files on a specified drive, recursively building the list?
> Suggestions or snippets would be appreciated.
Simp
> Here's a newbie question I guess. How would I build a list of all
> files on a specified drive, recursively building the list?
> Suggestions or snippets would be appreciated.
>
> Robert Maxwell
$drive = 'c';
open MYFILELIST, "dir $drive: /s/b |" or die "could not
spawn d
Look at the File::Find module. It will make your life a lot easier.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Maxwell
Sent: Monday, April 18, 2005 2:40 AM
To: ActivePerl@listserv.ActiveState.com
Subject: How to build a list of files on a
Robert Maxwell wrote:
> Here's a newbie question I guess. How would I build a list of all
> files on a specified drive, recursively building the list?
> Suggestions or snippets would be appreciated.
Simplest way would be to use File::Find and test for dir in the wanted
sub so you could treat th
I can't give you the snippet, but I can tell you the functions to use:
opendir (INDIR,"d:/");
my @items = readdir (INDIR);
closedir (INDIR);
foreach my $item (@items)
{
print "$item is a directory\n" if ((-d "d:/$item") and ($item !~
/\.|\.\./));
}
Take note that this reads in all elements, in
Here's a newbie question I guess. How would I build a list of all
files on a specified drive, recursively building the list?
Suggestions or snippets would be appreciated.
Robert Maxwell
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
T