Folder Structure
/home/admin/Downloads/Downloading/
Back.To.The.Future
/home/admin/Downloads/
Forward.To.The.Past
PHP code:
//Directories to search
$monitor = array(
'/home/admin/Downloads/Downloading/',
'/home/admin/Downloads/',
'/home/admin/ThirdFolder/'
);
//Looking for $release
$release = array('Back.To.The.Future','Forward.To.The.Past','NonExistingFolder');
foreach ($monitor as $path) {
foreach ($release as $name) {
if (file_exists($path . $name)) {
echo $name . ' exists in ' $path;
}
}
}
In my mind, I am expecting an output of
Back.To.The.Future exists in /home/admin/Downloads/Downloading/
and
Forward.To.The.Past exists in /home/admin/Downloads/
What I want to add to this code is the following
If $name does not exist in ANY of the $monitor folders, $delete[] = $name;
In which case, $delete[0] would be
NonExistingFolder