Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use File::Find;
- use Cwd 'abs_path';
- #$max_depth = 2;
- if( 1 != @ARGV )
- {
- print "błąd. Niepoprawna liczba argumentów\n";
- exit 1;
- }
- if ( ! -d $ARGV[0] )
- {
- print "błąd. plik nie jest katalogiem\n";
- exit 1;
- }
- my @arr;
- find(\&code, $ARGV[0]);
- sub code
- {
- if($_ ne "."){
- if ( -d $_ )
- {
- my $mode = (stat _)[2];
- $mode = $mode & 07777;
- my $usr = ($mode & 0700) >> 6;
- my $grp = ($mode & 0070) >> 3;
- my $real = abs_path($_);
- if($usr>0 and $grp==0){
- push @arr, $_;
- }
- #printf "$real has permissions %04o (%i,%i,%i)\n", $mode, $usr, $grp;
- }
- }
- }
- my @sorted = sort @arr;
- $" = "\n";
- print "@sorted";
- print "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement