First start on script to number discovery.
This commit is contained in:
parent
ab33daa5d8
commit
88260520a4
1 changed files with 34 additions and 0 deletions
34
build-label-upi-number.plx
Executable file
34
build-label-upi-number.plx
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# This expects a directory organized this way:
|
||||||
|
# rfp-NN/
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use autodie qw(:all);
|
||||||
|
|
||||||
|
use Getopt::Long;
|
||||||
|
use File::Spec;
|
||||||
|
|
||||||
|
sub UsageAndExit($) {
|
||||||
|
print STDERR "usage: $0 --inputToplevelDir==/path/to/inputdir [ --verbose=N ]\n";
|
||||||
|
print STDERR "\n $_[0]\n";
|
||||||
|
exit 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
my($VERBOSE, $INPUT_TOPLEVEL_DIR) =
|
||||||
|
(0, undef, undef, undef, undef, undef);
|
||||||
|
|
||||||
|
GetOptions("verbose=i" => \$VERBOSE, "inputToplevelDir=s", \$INPUT_TOPLEVEL_DIR) or UsageAndExit("invalid options");
|
||||||
|
|
||||||
|
|
||||||
|
UsageAndExit("\"$INPUT_TOPLEVEL_DIR\" is not a readable directory")
|
||||||
|
unless -r $INPUT_TOPLEVEL_DIR and -d $INPUT_TOPLEVEL_DIR;
|
||||||
|
|
||||||
|
opendir(my $topDH, $INPUT_TOPLEVEL_DIR);
|
||||||
|
while (my $rfp = readdir $topDH) {
|
||||||
|
next unless $rfp =~ /^\s*rfp-(\d+)\s*$/;
|
||||||
|
my $rfpDirName = File::Spec->catfile($INPUT_TOPLEVEL_DIR, $rfp);
|
||||||
|
print "$rfpDirName\n";
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue