469,575 Members | 1,662 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

rmdir permission errors on a Windows box

ok, I've got a peice of code that deletes folders, wether empty or
non-empty and I keep getting these errors:

Warning: rmdir(./modules/test/Copy of test/Random Folder)
[function.rmdir]: Permission denied in
c:\webdesign\fms\modules\functions.php on line 44

Warning: rmdir(./modules/test/Copy of test) [function.rmdir]:
Directory not empty in c:\webdesign\fms\modules\functions.php on line
52

Warning: rmdir(./modules/test/) [function.rmdir]: Directory not empty
in c:\webdesign\fms\modules\functions.php on line 52

I've tried including chmod("$dir/$entryname", 0777); in my function
before it attempts to do anything with any file or directory, and I've
also tried using ini_set ("safe_mode", 0); to turn safe mode off but i
still get these errors.

I've exhausted everything i can think of, so yeah, eny help anyone can
give I will greatly appreciate.
Jul 17 '05 #1
4 6032
*** Alex Kouzemtchenko escribió/wrote (29 Sep 2004 00:19:55 -0700):
ok, I've got a peice of code that deletes folders, wether empty or
non-empty and I keep getting these errors:

Warning: rmdir(./modules/test/Copy of test/Random Folder)
[function.rmdir]: Permission denied in
c:\webdesign\fms\modules\functions.php on line 44


I'd say that it's an NTFS disk and the user the web server runs as does not
have write permission on those folders.

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
Jul 17 '05 #2
"Alvaro G. Vicario" <kA*****************@terra.es> wrote in message news:<om****************************@40tude.net>.. .
*** Alex Kouzemtchenko escribió/wrote (29 Sep 2004 00:19:55 -0700):
ok, I've got a peice of code that deletes folders, wether empty or
non-empty and I keep getting these errors:

Warning: rmdir(./modules/test/Copy of test/Random Folder)
[function.rmdir]: Permission denied in
c:\webdesign\fms\modules\functions.php on line 44


I'd say that it's an NTFS disk and the user the web server runs as does not
have write permission on those folders.


First of all, yes it is an NTFS disk (Its my home machine, I don't
have anywhere else to test my scripts), but Apache runs as
Administrator, and is able to deleete Files but seems unable to delete
folders, which completely mystifys me.
Jul 17 '05 #3
*** Alex Kouzemtchenko escribió/wrote (30 Sep 2004 17:58:33 -0700):
First of all, yes it is an NTFS disk (Its my home machine, I don't
have anywhere else to test my scripts), but Apache runs as
Administrator, and is able to deleete Files but seems unable to delete
folders, which completely mystifys me.


Are the directories empty?
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
Jul 17 '05 #4
"Alvaro G. Vicario" <kA*****************@terra.es> wrote in message news:<1m*****************************@40tude.net>. ..
*** Alex Kouzemtchenko escribió/wrote (30 Sep 2004 17:58:33 -0700):
First of all, yes it is an NTFS disk (Its my home machine, I don't
have anywhere else to test my scripts), but Apache runs as
Administrator, and is able to deleete Files but seems unable to delete
folders, which completely mystifys me.


Are the directories empty?


Yes the directories are empty, what this part of my script does is
systematically delete all files and folders from a selected folder,
files are deleted first, and then the most bottom level directories,
All the files get removed but even the most bottom level directories
are not deleted.

the source to the function concerned is here:

function deldir($dir){
$current_dir = opendir($dir);
while ($entryname = readdir($current_dir)) {
$direntryname = "$dir/$entryname";
$direntryname = str_replace ("//", "/", $direntryname);
if ((is_dir($direntryname) && ($entryname != ".") && ($entryname !=
".."))) {
chmod($direntryname, 0777);
if (checkdir($direntryname)) {
deldir($direntryname);
} else {
rmdir ($direntryname);
}
} elseif(($entryname != ".") && ($entryname!="..")) {
chmod($direntryname, 0777);
unlink($direntryname);
}
}
closedir($current_dir);
rmdir($dir);
}

and all checkdir does is check ifa certain directory is empty or not
and returns true if it is NOT empty and false if the directory is
empty.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Daniel | last post: by
12 posts views Thread by Russ | last post: by
1 post views Thread by Mr.KisS | last post: by
3 posts views Thread by royG | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.