develooper Front page | perl.beginners | Postings from December 2002

Archive Logs

Thread Next
From:
Tim Martin
Date:
December 28, 2002 12:16
Subject:
Archive Logs
Message ID:
005601c2aead$eb15e0d0$6401a8c0@pc20010107
Hi Folks

Need help in getting the code to work in a Win32 perl system.
I was able to get it to work in a Linux system but not on a Windows 2000
Server.
Could you folks please review the code between Archive Logs Report and
exit 0;
I just gave up and put in the code that works in a shell script.

Thanks for your help. 
------------------------------------------------------------------------
-------

#!/Perl/bin/perl.exe -w 

################################################### 
# 
# This script moves the working file into a 
# archive directory and place a date stamp
# on the archive files.
# 
################################################### 
######################  Start of Script  ###################### 
$time_string = time_string();
######################  Archive Logs Report  ###################### 

c:
cd \
cd \EDS\CLM\Merge_Processing_Area             # <-- Source location of
the files to be archive
tar -czvf c:\EDS\CLM\Weekly_Archive_Logs\%DATE%.tgz * >>
c:\CLM\Weekly.log  # <-- Location of archive to be placed with date
stamp and logged. 
cd \

exit 0; 

######################  Time stamp  ###################### 
# Create timestring for log file 
sub time_string { 
my ($time_string, $sc, $mi, $hr, $dy, $mo, $yr); 
 
($sc, $mi, $hr, $dy, $mo, $yr) = localtime(time); 
$mo += 1; 
$yr += 1900; 
$time_string = sprintf( "%04d%2d%02d", 
     $yr, $mo, $dy ); 
return $time_string; 
}
######################  End of Script  ######################


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About