CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
serching for a file name within a certain...

 



ultimategamer2k
User

Mar 6, 2001, 1:21 PM

Post #1 of 2 (299 views)
serching for a file name within a certain... Can't Post

how would i make a script that will open a certain directory, and serch for a specified file name?
for example, i would like to find a file called whatever in the directory today..
i need some help!!!!

visit my web site at http://ultimategamer.cjb.net


japhy
Enthusiast

Mar 6, 2001, 1:29 PM

Post #2 of 2 (298 views)
Re: serching for a file name within a certain... [In reply to] Can't Post

You don't need to "search" for it, unless you mean that the file "foo.pl" in the directory "bar" might be in "bar/other/foo.pl".

If you just mean "does bar/foo.pl exist?", the use the -e file-test:


Code
if (-e "$dir/$file") { ... }

Otherwise, use the File::Find module.

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives