perl -MFile::Find -e 'find(sub {my $f = $File::Find::name; print $f, "\n" if -w $f && !-l $f}, "/")'
The following snippet will identify the files that are writeable for the given user - but only if the current user can access all of the directories that the specified user can see. If you can't see it, you can't check it. Note that this version will collect all of the files before printing anything.
use File::Find::Rule::Permissions;
my $user = @ARGV ? $ARGV[0] : $ENV{USER};
print $_,"\n" for File::Find::Rule::Permissions->file()
->permissions( user => $user, isWriteable => 1)
->in("/");
perl -MFile::Finder -e 'File::Finder->type("f")->perm("-200")->ls->in(@ARGV)' .
-- [http://www.stonehenge.com/merlyn/|Randal L. Schwartz, Perl hacker]
Be sure to read [id://205373|my standard disclaimer] if this is a reply.
perlmonks.org content © perlmonks.org and imp, merlyn
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03