I have this script to access all the xml files in a folder. But how would I specify a directory inside the glob ?
Here's my code :-
foreach (glob("*.xml*") as $filename) {
echo $filename."<br />";
}
I have this script to access all the xml files in a folder. But how would I specify a directory inside the glob ?
Here's my code :-
foreach (glob("*.xml*") as $filename) {
echo $filename."<br />";
}
You can add the directory in this way :-
$dir="dirname/";
foreach (glob("$dir*.xml*") as $filename) {
echo $filename."<br />";
}
Notice :- When you echo the filename, the directory would come attached to it. So for instance the filename is example.txt, then the output will be dirname/output.txt. You can then use explode to remoe the dir name.