I have a list of file paths that I want to delete. I placed the file paths in a plaintext file in the root directory of the server. For example:
files_to_be_removed.txt
/path/to/bad/file.php
/path/to/another/bad/file.php
In the same directory, I have another file:
remove.php
$handle = @fopen("files_to_be_removed.txt", "r");
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
if (unlink($buffer))
echo $buffer . ' removed.';
}
fclose($handle);
}
When I run my script, nothing is output. Simply, the files in the list aren’t being deleted. Why is that?