By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

rmdir permission errors on a Windows box

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
*** 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

P: n/a
"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

P: n/a
*** 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

P: n/a
"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.