9951 explained code solutions for 126 technologies


phpRemove a directory that is not empty


This will work only on Linux:

system('rm -rf — ' . escapeshellarg($dir));ctrl + c
system

executes OS command

rm -rf

removes given files and folders

escapeshellarg

safely escapes arguments to pass to a system command

$dir

path of the directory to remove