my $base = 'D:\\Some\\specific\\folder\\'; opendir (my $dhb, $base) or die "Cannot open ".$base.": ".$!; closedir $dhb; #### # 0 1 2 3 4 5 6 7 8 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # $mon the month in the range 0..11 , with 0 indicating January and 11 $mon += 1; # $year contains the number of years since 1900. To get a 4-digit year write: $year += 1900; #### if (@files) { foreach my $file (@files) { if ($file = glob(($base)."*.txt")){ move($file, $to) or die ("The move operation failed for ".$file." because ".$!); print "Moved ".$file." to ".$to or die $!; } next; } } else { print "No files found to move\n"; }