Home: Fun With Perl: Perl Quizzes - Learn Perl the Fun Way:
Directory Structure in perl


Oct 2, 2008, 7:31 PM

Views: 45805
Directory Structure in perl

I m newbie in the perl.
I have to implement the Directory structure in the perl.(i.e. Folder and that folder having the other files which are opened in the folde click event .just like our Winndows OS folder Structure like c and D drive.)

how to go ahead?
Pls provide some code or any links.


Oct 4, 2008, 2:55 AM

Views: 45778
Re: [talk2mishal] Directory Structure in perl

I can help you with a script that would extract the files and folders recursively from a directory.
You can use this and achieve your result

#!/usr/bin/perl -l
use File::Find;

$start_dir = shift || '.';

find( sub{
-f $_ and push @files, $File::Find::name;
-d $_ and push @dirs, $File::Find::name;
}, $start_dir );
print "@files";
print "@dirs";

If some one can do it, we can do it better


Oct 5, 2008, 10:23 AM

Views: 45701
Re: [maestria] Directory Structure in perl

Thanks a lot for such a valuable reply which helps me a lot for my initiation part of my task and increased a confidence to go ahead by using the Positive Thinking..