If i have a temporary directory (windows) : c:\TEMP\temporarywebfiles\ and within this i create another temporary directory linked to a username (created on login)so i have : c:\TEMP\temporarywebfiles\edwardp_temp\ if i use rmdir($dir) ($dir being the example) will it try and remove just the edwardp_temp directory or will it try and remove the whole directory structure if they are empty??
I have this routine:
if (is_dir($_SESSION['usrdir'])) {
$handle = opendir($_SESSION['usrdir']) or exit('could not open directory');
while (($file = readdir($handle)) !== false) {
if ($file != '.' && $file != '..') {
unlink($_SESSION['usrdir'] . $file) or exit('could not delete file');
}
}
rmdir($_SESSION['usrdir']) or exit('could not delete directory');
}
if there are any files in the directory they are removed but when removing the directory it returns the 'could not delete directory'