use strict; use POSIX; use File::Copy; use File::Basename; use File::stat; my $src; my $dst; print "\nEnter Source Directory: "; chomp($src = ); $dst = $src; $dst =~ s/inbox/queue/g; print "\nDESTINATION DIRECTORY SET TO: $dst\n"; chdir $src || die "Can't chdir to !\n" ; my $count; my $limit; print "\nEnter File Limit: "; chomp($limit = ) $count = 1; for my $file (<*.imap>) { $count = $count + 1; my ($name,$path,$suffix) = fileparse($file,"\.imap") ; my $info = stat($file); my $datestamp = strftime("%Y%m%d", localtime($info->mtime)); mkdir "$dst\\$datestamp" or "Error making Directory $!\n"; print "\n Moving \"$file\" >> $dst\\$datestamp"; move $file,"$dst\\$datestamp\\$name$suffix" or warn "Cannot copy $file $!\n"; if($count > $limit) { print "\n \nFile Limit Reached. Stopping\n"; exit;} }