acctman Posted February 21, 2009 Share Posted February 21, 2009 to call the function below, i include the file at the top and then use usr_delete_dir() but do I have to include $usrdir = '/temp/'; or do i put usr_delete_dir('/temp/'); function usr_delete_dir($usrdir) { if (is_dir($usrdir)) $dir_handle = opendir($usrdir); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($usrdir."/".$file)) unlink($usrdir."/".$file); else delete_directory($usrdir.'/'.$file); } } closedir($dir_handle); rmdir($usrdir); return true; } Quote Link to comment Share on other sites More sharing options...
thebadbad Posted February 21, 2009 Share Posted February 21, 2009 The latter. Simply declaring $usrdir won't feed it to the function; only if you run usr_delete_dir($usrdir) afterwards. Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 21, 2009 Share Posted February 21, 2009 If I understand your question correctly usr_delete_dir('/temp/'); should work. Although you can always do: $dirToDelete = '/temp/'; usr_delete_dir($dirToDelete); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.