'FILREN15.BAS 'Created 3 December 1999 by Bruce Cook 'Commented 4 December 1999 by Bruce Cook 'Revised 20 December 1999 to speed zipping 'Revised 2 February 2000 to exclude save to Jaz drive 'Revised 10 May 2000 for Lost Creek 'Revised 24 July 2006 to update directory of log file 'Basic program executed at the start of every day to compress, 'rename, backup on hard drive, copy to Jaz disk, and delete 'the pevious day's data from storage areas 1 and 2 of the CR23X '(lcreek.dat and lcreek2.dat) and CR10X (profile.dat and profile2.dat), 'and the CSI status/communications log (swf$.log). 'Resume program if error encountered ON ERROR RESUME NEXT 'Open lcreek2.dat to get date/time information need for naming file '(note: use 2nd row of data, since 1st line can be incomplete) OPEN "c:\cheas\lcreek2.dat" FOR INPUT AS #1 INPUT #1, arr, yr$, day$, hrmin$ LINE INPUT #1, a$ INPUT #1, arr, yr$, day$, hrmin$ LINE INPUT #1, a$ CLOSE 'Determine if data is ok IF (arr = 2) AND (VAL(yr$) >= 1998) THEN 'Extract data for renaming file, and create file names nyr$ = RIGHT$(yr$, 2) IF VAL(day$) >= 100 THEN nday$ = day$ ELSEIF VAL(day$) < 100 AND VAL(day$) >= 10 THEN nday$ = "0" + day$ ELSEIF VAL(day$) < 10 THEN nday$ = "00" + day$ END IF IF VAL(hrmin$) >= 1000 THEN ntime$ = LEFT$(hrmin$, 2) ELSEIF VAL(hrmin$) < 1000 AND VAL(hrmin$) >= 100 THEN ntime$ = "0" + LEFT$(hrmin$, 1) ELSEIF VAL(hrmin$) <= 100 THEN ntime$ = "00" END IF nname$ = "c:\cheas\" + nyr$ + nday$ + ntime$ + "a.gz" nname2$ = "c:\cheas\" + nyr$ + nday$ + ntime$ + "b.gz" nname3$ = "c:\cheas\" + nyr$ + nday$ + ntime$ + "c.gz" nname4$ = "c:\cheas\" + nyr$ + nday$ + ntime$ + "d.gz" nname5$ = "c:\pc208w\" + nyr$ + nday$ + ntime$ + "l.gz" 'Compress data files PRINT "Compressing lcreek.dat..." SHELL ("gzip -afqv1 c:\cheas\lcreek.dat") PRINT "Compressing lcreek2.dat..." SHELL ("gzip -afqv1 c:\cheas\lcreek2.dat") PRINT "Compressing profile.dat..." SHELL ("gzip -afqv1 c:\cheas\profile1.dat") PRINT "Compressing profile2.dat..." SHELL ("gzip -afqv1 c:\cheas\profile2.dat") PRINT "Compressing swf$.log..." SHELL ("gzip -afqv1 c:\pc208w\swf$.log") PRINT " " 'Rename data files PRINT "Renaming files..." PRINT " " NAME "c:\cheas\lcreek~1.gz" AS nname$ NAME "c:\cheas\lcreek~2.gz" AS nname2$ NAME "c:\cheas\profil~1.gz" AS nname3$ NAME "c:\cheas\profil~2.gz" AS nname4$ NAME "c:\pc208w\swf$lo~1.gz" AS nname5$ 'Backup files PRINT "Backing up files on hard disk..." SHELL ("copy c:\cheas\*.gz c:\cheas\backup") SHELL ("copy c:\pc208w\*.gz c:\cheas\backup") PRINT " " 'PRINT "Copying files to Jaz disk..." 'SHELL ("md d:\lcreek") 'SHELL ("copy c:\cheas\*.gz d:\lcreek") 'SHELL ("copy c:\pc208w\*.gz d:\lcreek") 'PRINT " " 'Delete files and end program PRINT "Deleting files..." KILL "c:\cheas\*.gz" KILL "c:\pc208w\*.gz" PRINT " " END IF