YouEnjoyMyself
IS-IT--Management
Ok here is what I am trying to accomplish, mind you I have some perl expierence but not a lot. What I am trying to do is have a script that reads through a tab delimited text file and parses out a single column. I already have that part of the script (see below). The issue I am running into is that the input file that this script parses from gets a new file name everyday. The file name looks like this :
File List F-000064 2-23-2005
The part that changes is highlighted in bold. It changes to the date of the day and numerical part (000064) goes up by one upon each creation of the input file. Is there any way I can get the script to know when the input file name changes? I might not be asking this in the right way, any help is appreciated, these forums have helped me a lot in the past. Thanks in advance!
What I have so far:
open(DFILE, "< C:\\File List F-000064 2-23-2005") || die "ERROR\n"; #opens filelist created by vertices
while(<DFILE>){
chomp;
$sn = (split(/\t/,$_))[1];
$sn =~ s/^\s+//;
$sn =~ s/\s+$//;
if ($sn =~ /^[0-9]+$/) {
push(@list, $sn);
}
}
close(DFILE);
open(OUT, "> C:\\fileout.txt") || die "ERROR\n";
select(OUT);
$| = 1;
print OUT join(':', sort @list), "\n";
select(OUT);
$| = 1;
select(STDOUT);
$| = 1;
close(OUT);
#takes all serial numbers out of the file list and place them into a text file each seperated by a ':'
system ( 'C:\\eject.cmd' ) && die "Cannot run eject.cmd" ; #run eject command and ejects tapes from outfile.txt
File List F-000064 2-23-2005
The part that changes is highlighted in bold. It changes to the date of the day and numerical part (000064) goes up by one upon each creation of the input file. Is there any way I can get the script to know when the input file name changes? I might not be asking this in the right way, any help is appreciated, these forums have helped me a lot in the past. Thanks in advance!
What I have so far:
open(DFILE, "< C:\\File List F-000064 2-23-2005") || die "ERROR\n"; #opens filelist created by vertices
while(<DFILE>){
chomp;
$sn = (split(/\t/,$_))[1];
$sn =~ s/^\s+//;
$sn =~ s/\s+$//;
if ($sn =~ /^[0-9]+$/) {
push(@list, $sn);
}
}
close(DFILE);
open(OUT, "> C:\\fileout.txt") || die "ERROR\n";
select(OUT);
$| = 1;
print OUT join(':', sort @list), "\n";
select(OUT);
$| = 1;
select(STDOUT);
$| = 1;
close(OUT);
#takes all serial numbers out of the file list and place them into a text file each seperated by a ':'
system ( 'C:\\eject.cmd' ) && die "Cannot run eject.cmd" ; #run eject command and ejects tapes from outfile.txt