blackadder has asked for the wisdom of the Perl Monks concerning the following question:
use warnings 'all'; use Win32::Perms; use Win32::NetAdmin; my $srv = shift @ARGV; my $drv = pop @ARGV; my $unc_path = "\\\\" . $srv . "\\" . $drv . "\\"; print "\nServer\t: $srv\nDrive\t: $drv\nUnc\t:$unc_path\n"; my $file_counter = 1; &proccess_dir ("$unc_path"); sub proccess_dir { my ($dir_name) = @_; my ($file, $sub_dir, $file_var); $file_var = "CONST" . $file_counter++; opendir ( $file_var,"$unc_path") || warn "\n$! : $unc_path\n"; print "$dir_name\n"; $dir = new Win32::Perms ($dir_name) || return 0; $dir -> Dump; print "\n\n\n***********************************\n\n\n"; $dir -> Remove ('everyone');# it hangs here forever $dir -> Set ( ); $dir -> Dump; while ( $file = readdir ( $file_var ) ) { next if ( $file eq "." || $file eq ".." ); } rewinddir ( $file_var ); while ( $sub_dir = readdir ( $file_var ) ) { next unless (-d ( $dir_name . "/" . $sub_dir ) ); next if ( $sub_dir eq "." || $sub_dir eq ".." ); &proccess_dir ($dir_name . "/" . $sub_dir ); } closedir ( $file_var ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Removing Permissions
by particle (Vicar) on Jun 17, 2002 at 11:29 UTC | |
by Anonymous Monk on Jun 17, 2002 at 13:37 UTC | |
by Anonymous Monk on Jun 17, 2002 at 13:56 UTC | |
by particle (Vicar) on Jun 17, 2002 at 18:26 UTC | |
Re: Removing Permissions
by caedes (Pilgrim) on Jun 17, 2002 at 13:01 UTC | |
by Anonymous Monk on Jun 17, 2002 at 13:35 UTC |