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: Need a Custom or Prewritten Perl Program?: I need a program that...:
Finding a File inside a Directory

 



cbwery2
Deleted

Sep 13, 2000, 1:52 PM

Post #1 of 2 (838 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.


Kanji
User / Moderator

Sep 13, 2000, 3:48 PM

Post #2 of 2 (838 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";
}</pre><HR></BLOCKQUOTE>

 
 


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

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