perl list of directories

Posted on 2009-04-20
Last Modified: 2012-05-06
How can I get the list of directories?

I basically need to execute script2 for each directory so that my script ends up executing the following commands:

perl dir1
perl dir2
perl dir3
# here is how i'm attempting to get the list of directories however this is recursive and I only want # the list of directories in the specified

# i tried setting  no_chdir to 0 but it didn't help

my @folders;

find sub{

	push @folders, "$File::Find::name" if (-d $File::Find::name);


Open in new window

Question by:NewtonianB
    1 Comment
    LVL 84

    Accepted Solution

    @folders = grep -d,<*>; #is a list of folders in the current directory

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
    I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now