I have a similar problem, but maybe with a different cause (it only happens with Perl CGI)...

 

In an IIS CGI script, ActiveState Perl 5.6.1, Win2000 Advanced Server SP2, IIS 5 with the NIMDA patch, I use the following recursive function to remove a dir tree:

 

sub removeDir {

 my($dir) = @_;

 my($child);

 opendir(DIR,$dir) || return 0;

 @list = grep(!/^\.+$/o,readdir(DIR));

 close(DIR);

 foreach (@list) { # kill children

  $child = "$dir/$_";

  if (-d $child) {&removeDir($child);}

  else {unlink($child);}

 }

 $success = rmdir($dir);

 

BUT, rmdir always fails - returns 'Permission Denied' in $!.

I have verified that this fails when the dir is empty (if it contains no directories, all files are indeed first unlinked).

I can mkdir without any problems, and I have set the IIS user to be an administrator, and I have allowed Everyone to have Full Access to the (NTFS) directory, to no avail. If I run the same code via DOS, it works, so I'm convinced it's something with IIS. Maybe a security 'patch' ??

 

-Randy

Reply via email to