473,385 Members | 1,343 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,385 software developers and data experts.

how to search for a number of files in a directory using perl.

how to search for a number of files in a directory using perl.
Jul 20 '07 #1
8 1305
savanm
85
Hi Ram...

This is the basic example

use Cwd;
$path=getcwd();
opendir(DIR,$path) || die ("Path is invalid\n");
@files=grep(/\./,readdir(DIR));
$i=0;
foreach $fil (@files)
{
print "$fil\n";
$i++;

}
print "Total number of files $i";

hope this will help you..

nAvAs.M
Jul 20 '07 #2
if i am supposed to search for some number of files and have to display,, what can i do..???
Jul 20 '07 #4
numberwhun
3,509 Expert Mod 2GB
if i am supposed to search for some number of files and have to display,, what can i do..???
Did you happen to see the example provided nicely, above, by "savanm"?

Have you tried that example, or any other for that matter? If you are working on some code to do what you are asking and are having problems, then please post your code so we can help you with it. We aren't going to write it for you, but we will help you with your issues if we can.

Regards,

Jeff
Jul 20 '07 #5
KevinADC
4,059 Expert 2GB
if i am supposed to search for some number of files and have to display,, what can i do..???
read the previous posts, look up the functions mentioned, (opendir, grep, readdir, freach, etc, etc, etc) try and understand them, write some code, test the code, then ask some questions about the code you wrote and where you are having problems. Simply repeating your question over is not going to inspire anyone to want to help you. You need to show some effort.

If you had even looked at the book I posted a link for you, you would have come across chapter 6 page 213 which probably will help you.
Jul 20 '07 #6
numberwhun
3,509 Expert Mod 2GB
read the previous posts, look up the functions mentioned, (opendir, grep, readdir, freach, etc, etc, etc) try and understand them, write some code, test the code, then ask some questions about the code you wrote and where you are having problems. Simply repeating your question over is not going to inspire anyone to want to help you. You need to show some effort.

If you had even looked at the book I posted a link for you, you would have come across chapter 6 page 213 which probably will help you.
Oh, you mean you meant for that book to be looked at?!!?!!? Oh MAN!!! What the heck? LOL!

Jeff
Jul 20 '07 #7
KevinADC
4,059 Expert 2GB
Oh, you mean you meant for that book to be looked at?!!?!!? Oh MAN!!! What the heck? LOL!

Jeff

hehehe... a "novel" idea, huh? ;)
Jul 20 '07 #8
numberwhun
3,509 Expert Mod 2GB
hehehe... a "novel" idea, huh? ;)
DOH!!! LOL!

Jeff
Jul 20 '07 #9

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

Similar topics

0
by: Auction software | last post by:
Free download full version , all products http://netauction8.url4life.com/ Groupawy --------------- Google Groups Email spider. The first email spider for google groups. Millions of valid...
0
by: Auction software | last post by:
Free download full version , all products from Mewsoft dot com http://netauction8.url4life.com/ Groupawy --------------- Google Groups Email spider. The first email spider for google groups....
2
by: ALI-R | last post by:
I am using the follwoing code to get all files which have txt as an extension but I get an error that your search pattern is not correct.it seems this fuction dosn't accept "*.txt" as search...
1
by: Petyr David | last post by:
Current: web page has hard coded directories (using checkboxes) user may choose to search for files matching a pattern they enter in text box. Perl is used to search for files and to format HTML...
16
by: Computer geek | last post by:
Hello, I am new to VB.NET and programming in general. I have taught myself a lot of the basics with vb.net but am still quite the novice. I am working on a little application now and I need some...
4
by: ravindarjobs | last post by:
hi...... i am using ms access 2003,vb6 i have a form. in that i have 2 buttons 1. start search 2 stop search when i click the "start search" button the fucntion SearchSystem() is called,...
4
by: Sutharsan Nagasun | last post by:
Hi, I am new to Perl. I need help with file search for the following scenario. Currently as part of the archiving process, we have archived the files under /$rootdir/Archive/yyyy directory where...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
1
by: briggs | last post by:
Hi All, I need to take the count of txt and bak files present in all the directory.for eg if we assume there are two directoies say(test1, test2), I need to collect the count(of txt and bak files)...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.