in reply to Wildcards for a wide array of strings?
This is amazing, the more I learn about this stuff, the more I'm starting to like it. Started with a 'task' which I didn't really want to do (bit out of my comfort zone), but ended up wanting to learn more and more about this new world. Well, new to me obviously.
Thank you very much for all the tips. I'll include the code I eventually ended up with. I think it's as short as it can possibly be and a lot of the suggestions are not included, this is because I like these things short, clean and clear (always try to do this with SQL too, with which I have more experience).
Might include some kind of logging if it goes wrong at some point, but I can't see this doing weird stuff as the applications that use these folders do what they're supposed to do.
#!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; my $base = 'D:\\Some\\Specific\\Folder\\'; # The source folder my $to = $base.localtime()->ymd ('\\')."\\"; # The destination folder foreach my $file (glob qq($base\*.txt)) { File::Copy::move $file, $to or warn "Can't move $file to $to : $ +!"; } # The actual move exit 0; # The graceful ending
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Wildcards for a wide array of strings?
by Discipulus (Canon) on May 24, 2017 at 08:33 UTC | |
by zarath (Beadle) on May 24, 2017 at 08:45 UTC |