I want to use perl File::Find::Rule in order to find files in the server that have perms 777
I know that the module has stats tests so i could simply do this:
$rule->mode(33279)
I found the 33279 by creating a file and printing the permission on it assuming that File::Find::Rule takes decimal? or should it be formatted somehow?
Is this the right approach to have all the file that have exactly the 777 permissions?
this is a script that finds all files on the home dir of a test server.. i want to change it so that it only finds those with 777 permissions.
#!/usr/bin/perl
use strict;
use warnings;
use File::Find::Rule;
my $rule = File::Find::Rule->new;
$rule->file;
$rule->name( '*' );
my @files = $rule->in( "/root" );
for my $file (@files) {
my $mode = (stat $file)[2];
printf ("%04o %s\n",$mode & 07777, $file);
}