473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 11176
numberwhun
3,509 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,509 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,509 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,509 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

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

Similar topics

1
by: Thieum22 | last post by:
Hi, I try to go through a directory and it's subdirectories to reah the properties of each files. But I have a problem to set active the directory where the files are, in order to display their...
2
by: Arjen | last post by:
Hello, I want to make a command line application that search for *.htm* files inside directories and subdirectories. 1. How can I save all the *.htm* files inside directories and...
8
by: RML | last post by:
hey guys, i am looking at this piece of code that lists numbers of files in a directory. i want to convert it so it lists the files in th directory that end with .doc. i cant seem to get it to...
2
by: melo | last post by:
Hello, I've been struggling with a function(s) to recursively set all folders and files to NOT read-only. So, I thought I'd post this message. What I need to do is: given a starting path, I...
1
by: Benton | last post by:
Hi there, I want to have an unrestricted root directory and some protected subdirectories on my ASP.NET 2.0 application. I want each subdirectory to have its own Login.aspx page. The...
2
by: kamalak | last post by:
hi, can someone help me in writing code in C# for getting the no of files in a directory and all its subdirectories and their subdirectories where the no of subdirectories and their...
9
by: smoothoperator12 | last post by:
Hi all, I have spent hours trying to figure out where I have went wrong with my code for my recursive function to list all the files in a directory, and all of the files in all of its...
9
by: kkhan5000 | last post by:
Hello, I am new to PHP and have put together the following code just by copying other examples from the web. Now I am stuck and would like to sort and display files alphabetically, and also filter...
10
by: beary | last post by:
Hello all, I've done something a bit stupid and am hoping some kind soul out there can help me out. There's a piece of code that goes through and creates a high number of subdirectories within...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.