My O.S. is w2k and I put the argument 'C:\\' to run; then a message is
displayed:
C:\Documents and Settings\Administrador\Desktop>perl filefind.pl
Can't opendir(c:\/System Volume Information): Invalid argument
at filefind.pl line 7
Why and how to by pass this situation?
Other thing that seems to be basic in perl, but how to print the list
obtained from File::Find, like a for/foreach/while ?
Thanks,
Josimar
----- Original Message -----
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 20, 2003 11:45 PM
Subject: RE: readir
> Josimar Nunes de Oliveira <[EMAIL PROTECTED]> wrote:
>
> : use File::stat;
> :
> : listfiles( 'C:' );
> :
> : #
> : for($i=0;$i<$count;$i++){
> : print "\n", $allfiles[$i][0], ' => ', $allfiles[$i][1];
> : }
> : #
> :
> : sub listfiles{
> : my $folder = shift;
> : $folder .= '\\';
> : opendir ( my $media, $folder );
> : my @files = readdir( $media );
> : closedir( $media );
> : foreach (@files){
> : my $sb = stat($folder . $_);
> : ## mode 16895 or 16749 stands for subdirectory
> : if ($sb->mode == 16895 || $sb->mode == 16749){
> : if ($_ ne '.' and $_ ne '..'){
> : listfiles( $folder . $_ );
> : }
> : } else {
> : $allfiles[$count][0] = $_;
> : $allfiles[$count][1] = $folder;
> : $count++;
> : }
> : }
> : }
> :
>
>
> One reason File::Find was mentioned is that
> you can get the same thing with something like:
>
> use strict;
> use warnings;
>
> use File::Find;
>
> my @files;
> find( sub{ push @files, [ $_, $File::Find::dir ] }, 'c:/perl/bin/' );
>
>
> HTH,
>
> Charles K. Clarkson
> --
> Head Bottle Washer,
> Clarkson Energy Homes, Inc.
> Mobile Home Specialists
> 254 968-8328
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]