473,805 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Read a List of subdirectories in a Directory

3 New Member
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 11225
numberwhun
3,509 Recognized Expert Moderator Specialist
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 Recognized Expert Specialist
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
imfanee
3 New Member
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
imfanee
3 New Member
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 Recognized Expert Specialist
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 Recognized Expert Moderator Specialist
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 Recognized Expert Specialist
File::Util does not comes as a standard activestate perl module. You must have installed it.
Oct 4 '07 #8
numberwhun
3,509 Recognized Expert Moderator Specialist
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 Recognized Expert Specialist
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

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

Similar topics

1
18070
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 properties. If anyone know how to improve my method, or know a better one, he's welcome :-) Thanks,
2
3201
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 subdirectories inside a array? Can you give me an example?
8
2404
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 output correctly, i have included the original code, my modified code, and the output from my modifed code.. why does it list the files as "System.IO.FileInfo"??? thanks
2
10606
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 need to recursively go through all files and folders below the starting path and check if the file or folder is read-only and, if so, set it to not read-only. Any ideas?
1
2399
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 following article is a good start, but it uses a single Login.aspx located in the root directory to protect a subdirectory: http://www.theserverside.net/tt/articles/showarticle.tss?id=FormAuthentication
2
2511
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 subdirectories are not known. for example, to get the total no of files in C: or E: or so. thanks, kamala
9
19625
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 subdirectories. This is the code:
9
4322
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 what file type to display or not display. Thank you for your help. -kkhan5000 <?php /* ABOUT: This snippet will list all the files in the directory of your
10
2638
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 subdirectories, which is fine. Initially I forgot to create an index.html file in each directory to prevent viewing of its folders and files without people being logged in. I've fixed it now, but there are a whole heap of directories without this...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10364
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.