0
Good guys want to delete a folder from my site with php, and want to delete all files and sub-folders.
I’m using the following command:
unlink("Arquivos/$token");
Is that correct? It erases all files and sub-folders?
This is giving the following error:
Warning: unlink(Arquivos/5b6a7a075e26664fd69e23f60c5d55bc): Operation not permitted in /Library/WebServer/Documents/Sites/Sistema/Paginas/Servidor/Todos_Clientes.php on line 90
No, the
unlink
delete only one file, to delete the directory use thermdir
.– William Novak
To delete a folder is
rmdir()
, however, the folder must be empty. To resolve you need to create a recursion and checking what file you useunlink()
, whatever folder, usermdir()
.– Daniel Omine