in reply to [Soved] Re^2: File::Find - Traverse the first level directories from starting point - How?
in thread File::Find - Traverse the first level directories from starting point - How?
Great, thanks for the feedback!
A slightly more idiomatic way of writing your code:
use strict; use warnings; use Path::Tiny; my $dir = '//192.168.1.44/somedir'; path( $dir )->visit( sub { print "$_\n" if /^[^.]/ && $_->is_dir; });
Note that your code reads the names of all the files (plain files and directories) into two different variables; also I'm not sure about the regexp, it's not clear from your comment what names you are wanting to skip. The file/dir name at that point in the loop shouldn't have a leading slash IIUC.
Hope this helps!
Update: s/all the files/names of all the files/ thx soonix
|
|---|