#!/usr/bin/perl -w use strict; use File::Find; # set these to the desired min and max my $max_depth = 3; my $min_depth = 3; # find files my @files; find({ wanted => sub { my $depth = tr!/!!; # count slashes to get depth return if $depth < $min_depth or $depth > $max_depth; push @files, $_; }, no_chdir => 1 }, '.' ); # sort by mtime @files = sort { (stat($a))[9] <=> (stat($b))[9] } @files; # concat and print foreach my $file (@files) { open FILE, $file or die "Can't open $_ : $!"; while () { print } }