use strict; use warnings; use diagnostics; use autodie; use File::Copy::Recursive qw( rcopy ); use File::Path qw( mkpath remove_tree ); use File::Glob qw( :globally ); use File::Find; use File::Spec; use Getopt::Long; use Pod::Usage; use POSIX qw(strftime); use File::Spec::Functions; sub DirCompare{ my ( %old_list, %new_list, @diffs); for my $file (findfiles($ARCHIVE) ) { $old_list{$file} = 1; } for my $file (findfiles($SourceDir) ) { $new_list{$file} = 1; } for my $file (sort keys %old_list) { if ( !defined $new_list{$file} ) { push @diffs, "Old file not in new: $file"; } } for my $file (sort keys %new_list) { if ( !defined $old_list{$file} ) { push @diffs, "Old file not in new: $file"; } } if (@diffs) { my $msg = sprintf "WARNING: %s\n", join "\nWARNING: ", @errors; check_ok( $msg ); } return; }
Undefined subroutine &main::findfiles called at deploy.pl line 154 (#1) (F) The subroutine indicated hasn't been defined, or if it was, it has since been undefined. Uncaught exception from user code: Undefined subroutine &main::findfiles called at deploy.pl line 154. at deploy.pl line 154 main::DirCompare() called at deploy.pl line 243
If you have any input as to how I can better form the subroutine, please share your ideas.In reply to Comparing files in directory by smturner1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |