I'm trying to build a script to delete directories and getting the following error
Warning: opendir(temporary) [function.opendir]: failed to open dir: No such file or directory in /home/www/blone/files/delete_dir.php on line 12
Deleting Directory: temporary
This is likely due to my inability to correctly define the directory. I call the script with a URL that ends ?directoryz=/home/www/blone/files and I pick it up in my delete_dir.php file as follows:
<?php
$directoryz = $_GET['directoryz'];
if ($directoryz == '') {
echo "There is no directory defined. Go back and specify a directory to delete";
}
else { ?>
<?php
echo ($directoryz);
function deleteDir($directoryz) {
// open the directory
$dhandle = opendir($directoryz);
if ($dhandle) {
// loop through it
while (false !== ($fname = readdir($dhandle))) {
...
In my newbie mind, I assume the $_GET passes the directory string to $directory and my "echo" test appears to confirm that.
But then I guess it doesn't like my attempt to use that string in my opendir($directoryz) line. I've tried to make other variations unsuccessfully.
I didn't post the entire script due for the sake of brevity but can do so if that helps. I appreciate any help.
Jim