Is there a way to use Path::Tiny to recursively visit directories and files while not aborting completely if an item is inaccessible for some reason?
Specifically, on Windows using Strawberry perl 5.32.1.
AFAICT Path::Tiny's visit mechanism unconditionally throws an exception if opendir fails, as it is likely to do on various Window-ish system things.
use strict; use warnings;
use Path::Tiny qw/path/;
path(".")->visit(
sub{ print "Visiting $_[0]\n"; }, { recurse => 1 });
print "Done (did not abort)\n";
Running this on Windows (in an Aministrator command window) in the root of C: gives:
Visiting $Recycle.Bin
Visiting $WinREAgent
Visiting BOOTNXT
Visiting bootTel.dat
Visiting Brother
Visiting Jts
...
Error opendir on 'Documents and Settings': Invalid argument at Y:\test.pl line 3.
... and the contents of the folders Brother, Jts, etc. are never visited at all.