I had a similar problem in an unrelated context - a Domino server would
create a file then pass control off to a perl script. I found that putting
an arbitrarily long wait (like 5 minutes or longer) would work. Anything
shorter and it would randomly fail. I think the problem is some caching
Windows is doing in the FS layer where it keeps the directory open for
awhile.
Josh
"Pittelli, Randy" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
10/02/01 11:29 AM
To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
cc:
Subject: re: Empty directories won't delete?
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
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl