• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1969
  • Last Modified:

perl list of directories

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 script2.pl dir1
perl script2.pl dir2
perl script2.pl 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

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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now