I need to remove a folder and all it’s contents. Not sure if I need to change the permissions as well.
This is what I have right now, that isn’t working.
$file = "../images/".$code;
unlink($file);
The name of the folder that is going to be deleted is in $code.
Should this code work? Do I only need to change the chmod?
If so, how can I do this prior to the delete code?
Thank you. That one worked for me with an empty folder.
But since I have things in the folder as well I tried to add something, but it won’t delete my files. Why not?
unlink("$file/*.*");
rmdir($file); # deletes the folder
Then I tried to add one code that deletes all file types I think will be in the folder with this code.
But that one isn’t working either.