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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Finding a File inside a Directory



Sep 13, 2000, 1:52 PM

Post #1 of 2 (1996 views)
Finding a File inside a Directory Can't Post

I need to check if a file exist inside
a directory. For example

I want to check if the file video.mpg
does exist in /usr/src/images

Someone gave me an idea of put all
the files in an array and then search
inside the array.

User / Moderator

Sep 13, 2000, 3:48 PM

Post #2 of 2 (1996 views)
Re: Finding a File inside a Directory [In reply to] Can't Post

No need for an array: just use a file test operator such as the one for (whoa!) file existence!

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

if ( -e "/usr/src/images/video.mpg" ) {
print "It does";
} else {
print "It doesn't";


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

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