> -----Urspr�ngliche Nachricht-----
> Von: Brian Raven [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 8. Januar 2004 13:33
> An: [EMAIL PROTECTED]
> Betreff: RE: Script for reading permissions on win32 - Try
> Win32::FileSecu rity
> 
> 
> > -----Original Message-----
> > From: Altrock, Jens [mailto:[EMAIL PROTECTED] 
> > Sent: 08 January 2004 10:38
> > To: [EMAIL PROTECTED]
> > Subject: AW: Script for reading permissions on win32 - Try 
> > Win32::FileSecu rity
> 
> > Ok. I got it the way example1 says, and it works. The only 
> > thing I don't
> > know how to do is
> > to get all the directories in one directory and get their 
> > permissions...
> > 
> > Current source:
> > 
> >     use Win32::FileSecurity qw(Get EnumerateRights);
> >     sub Laufen {
> >     foreach (@ARGV){
> >             if(Get($_, \%hash)){
> >                     while(($name, $mask) = each %hash){
> >                             print "$name:\n\t";
> >                             EnumerateRights($mask,[EMAIL PROTECTED]);
> >                             print join ("\n\t",@happy),"\n";
> >                     }
> >             }
> >             else {
> >                     print("Error #",int($!),": $!");
> >             }
> >     }
> >     } 
> >     Laufen($StartDir);
> > 
> > Anyone knows how to implement that in this source?
> 
> I believe that your original post mentioned recursion, so you should
> probably look at File::Find. For example this little script does
> something like what you ask:
> 
> --------------------------------------------------------------
> ----------
> ---------------------
> use strict;
> use warnings;
> 
> use Win32::FileSecurity qw(Get EnumerateRights);
> use File::Find;
> 
> find \&wanted, @ARGV;
> 
> sub wanted {
>     return unless -d;
>     my %dacl;
>     Get $File::Find::name, \%dacl;
>     foreach my $group (sort keys %dacl) {
>       my @rights;
>       EnumerateRights $dacl{$group}, [EMAIL PROTECTED];
>       print "$File::Find::name $group @rights\n";
>     }
> }
> --------------------------------------------------------------
> ----------
> ---------------------
> 
> HTH
> 
> -- 
> Brian Raven

So one more question I do have... 
unless means he does it as long as there are any more directories. correct
me if I am not right at that
point. So if I want to search only in the upper 3 directories from the
starting directory maybe, I need
to have a counter that goes down by one after each directory right? Let's
call this $i. Am I right to 
decrease that number every time at the end of the unless-block? and I need
to check this in the unless-
part like: return unless -d || $i>0;

so that would look like this:

sub wanted {
        return unless -d || $i>0;
        my %dacl;
        Get $File::Find::name, \%dacl;
        foreach my $group (sort keys %dacl) {
                my @rights;
                EnumerateRights $dacl{$group}, [EMAIL PROTECTED];
                print OUT "Ordner:\t\t\t$File::Find::name\n";
                print OUT "Benutzer/Gruppe:\t$group\nRechte:\t\t\t";
                print OUT join ("\n\t\t\t",@rights),"\n\n";
                print OUT
("---------------------------------------------------\n\n");
        }
        --$i;
}

That was my thinking... as said correct me if i am not right here. Problem
is in the first directory he
checks the files within too... and the search goes anyway through all
directories... what's my error?

Regards,

Jens
###########################################
Diese Nachricht wurde von F-Secure Anti-Virus gescannt.

This message has been scanned by F-Secure Anti-Virus.


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to