Cleaned up visible output

This commit is contained in:
Tracey Clark 2018-05-20 12:07:59 -05:00
commit 74640cac00

View file

@ -8,11 +8,11 @@ use File::Basename;
use File::Find::Rule; # find all the subdirectories of a given directory use File::Find::Rule; # find all the subdirectories of a given directory
# http://search.cpan.org/~rclamp/File-Find-Rule-0.32/README # http://search.cpan.org/~rclamp/File-Find-Rule-0.32/README
use File::Path qw(make_path remove_tree); use File::Path qw(make_path remove_tree);
#use File::Copy;
#use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove); #use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
use File::Copy::Recursive qw(dircopy); use File::Copy::Recursive qw(dircopy);
use List::MoreUtils qw(uniq); use List::MoreUtils qw(uniq);
use File::DirCompare; use File::DirCompare;
use Data::Dumper;
my $now = localtime; my $now = localtime;
my $year = $now->year; my $year = $now->year;
@ -79,16 +79,19 @@ sub compare_dirs {
# Delete old files # Delete old files
sub delete_dirs { sub delete_dirs {
my ( $new_dir, $old_dir, $curr_year, $last_year ) = @_; my ( $new_dir, $old_dir, $curr_year, $last_year ) = @_;
print("Deleting files from current year in archives\ and"); print("Deleting files from current year in archives\n");
print("files from last year from current folder\n"); print("and files from last year from current folder\n");
print("New dir in the delete_dirs is $new_dir\n");
# For all files in archive dir that are newer than last year delete them # For all files in archive dir that are newer than last year delete them
my $find_rule = File::Find::Rule->new; my $find_rule = File::Find::Rule->new;
# $find_rule->nonempty->maxdepth(1)->mindepth(1)->relative; # $find_rule->nonempty->maxdepth(1)->mindepth(1)->relative;
$find_rule->name('*.' . $lastyear . '*'); $find_rule->name('*.' . $lastyear . '*');
my @curr_subdirs = $find_rule->directory->in( $new_dir ); my @curr_subdirs = $find_rule->directory->in( $new_dir );
foreach $subdir(@curr_subdirs) { print("This is the current subdirs in delete_dirs\n\n");
print("THING"); print Dumper(\@curr_subdirs);
foreach my $subdir(@curr_subdirs) {
print("Directory in current subdir is $subdir");
} }
# For all file in current folder that are older than this year delete them # For all file in current folder that are older than this year delete them
} }