Thank you sooo much everyone! I finally got it up & running! Should have posted here earlier.
I took items from pretty much everyone's advice, mixed them up and now it does what it's supposed to do.
In case someone wants to know what it has eventually become and / or feels the need to make it more efficient:
#!perl -w # # Archiver for processed EDI messages # - move all messages to existing subfolder *\yyyy\mm\dd use strict; use warnings; use Time::Piece; use File::Copy; use File::Path; use File::Glob; my $base = 'D:\\Some\\specific\\folder\\'; opendir (my $dhb, $base) or die "Cannot open ".$base.": ".$!; closedir $dhb; my @time = localtime; my $mday = $time[3]; my $month = $time[4] + 1; $month = sprintf("%02d", $month); my $year = $time[5]+1900; my $to = $base.$year."\\".$month."\\".$mday."\\"; opendir (my $dht, $to) or die "Cannot open ".$to.": ".$!; closedir $dht; my @files = glob($base."*"); foreach my $file (@files) { if ($file = glob(($base)."*.txt")){ move($file, $to) or die ("The move operation failed for ".$fil +e." because ".$!); print "Moved ".$file." to ".$to or die $!; } else { next; } } exit 0;
In reply to Re: Wildcards for a wide array of strings?
by zarath
in thread Wildcards for a wide array of strings?
by zarath
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |