in reply to Move a file to another directory based on regex match
Start simple:
I may be wrong, but I think your regex is wrong.
'+' is not a valid file name character.
Start by printing the proposed files to be moved:
I don't know what \+ means?
I may be wrong, but I think your regex is wrong.
'+' is not a valid file name character.
Start by printing the proposed files to be moved:
I don't know what \+ means?
#!/usr/bin/perl use strict; use warnings; use File::Copy; my ($inDir, $outDir) = @ARGV; opendir (DIR, $inDir) or die "Bad Input Directory $inDir $!\n"; while (my $infile = readdir(DIR)) { if ($infile =~ 'F\d{8}\.\d{4}\+\d{4}\-\d{4}\+\d{4}_.*') #like F12345678.1234+1234-9876+3456..... { print "$inDir/$infile\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Move a file to another directory based on regex match
by parv (Parson) on Feb 26, 2021 at 01:53 UTC | |
Re^2: Move a file to another directory based on regex match
by Anonymous Monk on Feb 25, 2021 at 22:23 UTC | |
by parv (Parson) on Feb 26, 2021 at 01:46 UTC | |
Re^2: Move a file to another directory based on regex match
by DAN0207 (Acolyte) on Feb 26, 2021 at 17:02 UTC |
In Section
Seekers of Perl Wisdom