in reply to Iterate trough a series of folders
You can use Path::Tiny for this:
The iterator will automatically skip . and ..#!/usr/bin/perl use strict; use warnings; use Path::Tiny qw/ path /; my $dir = "C:/Users/ST/DesktopSample"; my $iterator = path( $dir )->iterator({ recurse => 1, follow_symlinks => 0, }); while ( my $path = $iterator->() ) { if ( path( $path )->is_dir ) { ... } if ( path( $path )->is_file ) { ... } }
Hope this helps!
|
|---|