From 74640cac00c5c7ca9a8a27ff4b7192445b405181 Mon Sep 17 00:00:00 2001 From: Tracey Clark Date: Sun, 20 May 2018 12:07:59 -0500 Subject: [PATCH] Cleaned up visible output --- file_processing/archive_statements.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/file_processing/archive_statements.pl b/file_processing/archive_statements.pl index 30c9867..5eb9edd 100755 --- a/file_processing/archive_statements.pl +++ b/file_processing/archive_statements.pl @@ -8,11 +8,11 @@ use File::Basename; use File::Find::Rule; # find all the subdirectories of a given directory # http://search.cpan.org/~rclamp/File-Find-Rule-0.32/README 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(dircopy); use List::MoreUtils qw(uniq); use File::DirCompare; +use Data::Dumper; my $now = localtime; my $year = $now->year; @@ -52,13 +52,13 @@ my @curr_subdirs = $find_rule->directory->in( $financial_folder ); print("Copying current directories to archive folder\n"); print("From: $financial_folder\n"); print("To: $lastyear_folder\n"); -dircopy($financial_folder, $lastyear_folder) or die $!; +dircopy( $financial_folder, $lastyear_folder ) or die $!; # Make sure contents match compare_dirs( $financial_folder, $lastyear_folder ); # Delete all files from current year from archive folders -delete_dirs($financial_folder, $lastyear_folder, $year, $lastyear); +delete_dirs( $financial_folder, $lastyear_folder, $year, $lastyear ); # compare new directories to old directories to make sure they are the same sub compare_dirs { @@ -79,16 +79,19 @@ sub compare_dirs { # Delete old files sub delete_dirs { my ( $new_dir, $old_dir, $curr_year, $last_year ) = @_; - print("Deleting files from current year in archives\ and"); - print("files from last year from current folder\n"); + print("Deleting files from current year in archives\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 my $find_rule = File::Find::Rule->new; # $find_rule->nonempty->maxdepth(1)->mindepth(1)->relative; $find_rule->name('*.' . $lastyear . '*'); my @curr_subdirs = $find_rule->directory->in( $new_dir ); -foreach $subdir(@curr_subdirs) { - print("THING"); + print("This is the current subdirs in delete_dirs\n\n"); + 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 }