I'm writing some code to try and make some sense out of a mess of some windows file servers I have inherited. It's coming on quite nicely - I'm essentially trying to determine the size of various directories including all their subdirectories and files. To do this, I'm using File::Find::Rule with the following snippet of code:
The problem came when it tried to navigate a very deep directory: Can't cd to [very long path] at C:/Perl/lib/File/Find.pm line 929. The windows path-length at this point is waaaaay over the 255 character limit.use strict; use File::Find::Rule; my $dir = "c:/temp/test"; my @results = File::Find::Rule->file->in( $dir ); my $totalsize = 0; foreach my $result ( @results ) { $totalsize += (stat($result))[7]; } my $mbtotalsize = $totalsize /1024 / 1024; print "$dir=$mbtotalsize MB\n";
My question (finally!) is this - how can I stop File::Find::(Rule) dying at this point - I just want it to skip over any illegally named files (because of their path length). I could just change the File::Find module to "warn" instead of "die" at that point, but that may have unexpected consquences.
Any advice humbly received!
In reply to File:Find::Rule on Win32 by puploki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |