469,289 Members | 2,202 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

How To Read a List of subdirectories in a Directory

Hi ALL,

I want to read list of all subdirectories in an array in perl. I know how to get a list of all files in a directory but it does not show subdirectories in that list.

Can any help out on this issue.
Thanks in advanced.


Fanee G.
Oct 3 '07 #1
10 10714
numberwhun
3,503 Expert Mod 2GB
Hi ALL,

I want to read list of all subdirectories in an array in perl. I know how to get a list of all files in a directory but it does not show subdirectories in that list.

Can any help out on this issue.
Thanks in advanced.


Fanee G.
You will want to take a look at the File::Util module on CPAN. There is a function for "list-dir" that has an option to it to only list directories in a directory.

Regards,

Jeff
Oct 3 '07 #2
KevinADC
4,059 Expert 2GB
Hi ALL,

I want to read list of all subdirectories in an array in perl. I know how to get a list of all files in a directory but it does not show subdirectories in that list.

Can any help out on this issue.
Thanks in advanced.


Fanee G.

post the code you are using.
Oct 3 '07 #3
This is the code I am using.

I have also tried File-Util. But this is not available for windows when searching by ppm.

I tried to compile it using nmake but their are lot of errors.

This is the code i am using to find file list.

@files = <*>;
foreach $file (@files)
{
$counter = $counter += 1;
print $counter." = ".$file . "\n";
}
.
Oct 4 '07 #4
You will want to take a look at the File::Util module on CPAN. There is a function for "list-dir" that has an option to it to only list directories in a directory.

Regards,

Jeff
I have tried but this module is not available by windows when search by ppm.

I tried to compile it using nmake but it says lot of errors and stop.
Oct 4 '07 #5
KevinADC
4,059 Expert 2GB
This is the code I am using.

I have also tried File-Util. But this is not available for windows when searching by ppm.

I tried to compile it using nmake but their are lot of errors.
That looks like it should give you a list of all files and folders in the current directory.
Oct 4 '07 #6
numberwhun
3,503 Expert Mod 2GB
This is the code I am using.

I have also tried File-Util. But this is not available for windows when searching by ppm.

I tried to compile it using nmake but their are lot of errors.
I hate to break it to you, but I am also using Active State on Windows and File-Util IS on there and it is available. It may be that it is already installed by default, you need to check.

Regards,

Jeff
Oct 4 '07 #7
KevinADC
4,059 Expert 2GB
File::Util does not comes as a standard activestate perl module. You must have installed it.
Oct 4 '07 #8
numberwhun
3,503 Expert Mod 2GB
File::Util does not comes as a standard activestate perl module. You must have installed it.
I agree (after looking at a new installation on another machine), but, the fact does remain that it is definitely part of the PPM repository on Active State and is called "File-Util".
Oct 5 '07 #9
KevinADC
4,059 Expert 2GB
I don't see it listed on activestate in the perl module list.

The list goes:

File-Touch
Fle-VirtualPath


which skips any File-U* modules.
Oct 5 '07 #10
numberwhun
3,503 Expert Mod 2GB
I don't see it listed on activestate in the perl module list.

The list goes:

File-Touch
Fle-VirtualPath


which skips any File-U* modules.
Wow, where did you get your list from. You missed a few modules.

PM me your email address and I will send you a screen print of my PPM.
Oct 5 '07 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Arjen | last post: by
1 post views Thread by Benton | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.