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: Fun With Perl: Perl Quizzes - Learn Perl the Fun Way:
Directory Structure in perl

 



talk2mishal
Novice

Oct 2, 2008, 7:31 PM

Post #1 of 3 (21646 views)
Directory Structure in perl Can't Post

Hi,
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.


maestria
Novice


Oct 4, 2008, 2:55 AM

Post #2 of 3 (21619 views)
Re: [talk2mishal] Directory Structure in perl [In reply to] Can't Post

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
http://maestriatech.com
perl@maestriatech.com
--------------------------------------------------------------------


talk2mishal
Novice

Oct 5, 2008, 10:23 AM

Post #3 of 3 (21542 views)
Re: [maestria] Directory Structure in perl [In reply to] Can't Post

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..

 
 


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

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