If you want to find out both read and write, then you'll need to do 2 tests: one for read, one for write. Simply do a test with '-r' as well, such as the following (not tested, may/may not work as-is):
#!/usr/bin/perl -w
$|++;
use strict;
use File::Find;
my $dir = '/path/to/dir';
find(\&wanted, '/path/to/dir');
sub wanted {
if (not -w $_ && not -r $_) {
print "Cannot read or write $File::Find::name.\n";
} elsif (not -w) {
print "Cannot write $File::Find::name.\n";
} elsif (not -r) {
print "Cannot read $File::Find::name.\n";
}
}
If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.
|