0
I have a directory with images and need that each time you start the program the images are deleted except one.
I have for now the following code:
$dirtmp = "fotos/tmp";
$ditmp = new RecursiveDirectoryIterator($dirtmp, FilesystemIterator::SKIP_DOTS);
$ritmp = new RecursiveIteratorIterator($ditmp, RecursiveIteratorIterator::CHILD_FIRST);
foreach ( $ritmp as $file ) {
unlink($file);
}
This causes you to delete all files, but would like the file zVazio.jpg was never deleted from that folder.
Is there any way to before excluding (unlink) verify the file name and if zVazio.jpg he does not exclude ?
perfect... the file name will always be the same....
– Alexandre Prezzi