CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [DrRob] loss of readdir function with vista: Edit Log



KevinR
Veteran


Apr 17, 2009, 10:44 AM


Views: 4047
Re: [DrRob] loss of readdir function with vista

See if this works any better:


Code
sub read_folder {  
my(@list) = @_;
foreach my $folder (@list) {
opendir (DIR, $folder) or die "Can't open dir $folder :$!";
closedir (DIR) or die "Failed to close DIR: $!\n";
my @dir = readdir(DIR);
my $files = grep {-f "$folder/$_" && !/^\.+$/} @dir;
my @folders = grep {-d "$folder/$_" && !/^\.+$/} @dir;
print "Files:\n";
print "$_\n" for @files;
print "\nFolders\n";
print "$_\n" for @folders;
}
}

-------------------------------------------------


(This post was edited by KevinR on Apr 17, 2009, 10:45 AM)


Edit Log:
Post edited by KevinR (Veteran) on Apr 17, 2009, 10:45 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives