in reply to Re: creating a list of files under each subfolder in a main directory
in thread creating a list of files under each subfolder in a main directory
You don't need that grep stuff
#!/usr/bin/perl -- use strict; use warnings; use File::Find::Rule qw/ find rule /; use Path::Tiny qw/ path /; my @subdirs = rule( 'directory' , maxdepth => 1, )->in( 'startdir' ); for my $dir ( @subdirs ){ my $listFile = path( "$dir/List.txt" )->openw_utf8; rule( file => exec => sub { ## my( $shortname, $path, $fullname ) = @_; print $listFile "$_[2]\n"; return !!0; ## means discard filename }, )->in( $dir ); }
|
|---|