Hi,
I want to search a file's directory - so, if I search the file 0466-01-03.sldprt, PHP returns the path where the file is. All files are unique and on the server's filesystem (intranet).
Is that possible?
Printable View
Hi,
I want to search a file's directory - so, if I search the file 0466-01-03.sldprt, PHP returns the path where the file is. All files are unique and on the server's filesystem (intranet).
Is that possible?
Try something like this, you have to read all the files in the directory and match them.
The only other method i can think of would be to use exec() and execute "ls" or "dir" with the filename. and parse the results.PHP Code:<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if($file == "0466-01-03.sldprt"){ //match file
//do stuff with the file here
}
}
}
closedir($handle);
}
?>
Does that also work if the files are saved in other directories, eg. ../01/03? Engineers aren't predictable when it's about saving the files :P
You could make a recursive search function, if any result is a directory you call the function again with that base path.
It won't work...it just prints a blank screen
Oh, it's case sensitive :D