Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search for filename excluding file extension 1

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
0
0
FR

Hi guys,

How could I do to find if the file "photo_2" exists in the "photos" directory, regardless of the file extension, whenever it is photo_2.gif or photo_2.jpg?

file_exists() use extensions.
Is there a similar function so that I don't need to scan the whole directory?

Thanks! :)
 
you could use a system call (shell_exec()) to ls or dir (platform dependent) and then parse the result. that's about the easiest method I can think of.
 

Thanks :)
Well, I used the scan method in the end because I found that I need to count the files too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top