OnTheEdge has asked for the wisdom of the Perl Monks concerning the following question:
The script is run from the D: drive of the computername John. It is checking in the c:\daily directory for a file name daily_count_by_userid_and_domain.xls. This is just part of my existing script, since the rest of it works. Below is my code.
What I am doing wrong? How can I ensure that this file exists at the start of the script and that it will be deleted? I'm very sorry to have to ask what should be such an easy question.
#!d:\perl\bin use File::Copy; my $filename ='daily_count_by_userid_and_domain.xls'; my $path = '\\\\John\\c$\\daily\\'; my $nfile = '_daily_count_by_userid_and_domain.xls'; my $test = 'outputfile.txt'; ($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time); my $real = $Year + 1900; my ($d,$m) = (localtime)[3,4]; my $date = sprintf("%02d%02d",++$m,$d,); my $npath = '\\\\Bob\\scripts\\security\\public\\'; my $complete = '$path$filename'; opendir (HOLDING, 'C:\daily'); chdir 'C:\daily'; @asci = glob ('*.xls'); foreach $asci (@asci) { if ($asci =~ /$asci/) system ("del $asci"); } system("\"C:\\Program Files\\Microsoft Office\\Office\\MSACCESS.EXE\" d:\\imas_security\\imas_security.mdb /x auto_update"); open(OUT, ">>$test"); copy ("$path$filename", "$npath$real$date$nfile"); closedir(HOLDING); close (OUT);
MHTIA.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching for a file, confirming that it exists, then deleting it
by chromatic (Archbishop) on Apr 11, 2002 at 19:39 UTC | |
|
Re: Searching for a file, confirming that it exists, then deleting it
by tadman (Prior) on Apr 11, 2002 at 19:59 UTC |