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



FishMonger
Veteran / Moderator

Apr 18, 2009, 5:39 AM


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

This is the method I'd use.

Code
#!/usr/bin/perl 

use strict;
use warnings;
use File::Find;

my (@files, @folders);

find({ wanted => \&read_folder, no_chdir => 1 }, 'c:/testing');

sub read_folder {
return if $_ =~ /^\./;
push @files, $_ and return if -f $_;
push @folders, $_ and return if -d $_;
}

print "Files:\n";
print "$_\n" for @files;
print "\nFolders\n";
print "$_\n" for @folders;



(This post was edited by FishMonger on Apr 18, 2009, 5:41 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Apr 18, 2009, 5:41 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