#<$Figure out J Install Changes - Ver DN-1A(4) - [YTP-ECAR]$> #Assumptions: #Run in JDIR (J base directory) #Have J4xxx.EXE there (Currently wired to J406D.EXE by first assignment stmt) #Uses WZZIP (Command line interface to WinZip) #UNJ produces: # (1) An on screen statement of what's changed and missing # (2) A TMP.BAT with calls on CHANGE GONE and (if '-s' switch is given) SAME #Likely Generalizations (difficulty) # (1) Get name of .EXE by `lookup' (trivial) # (2) List files present that aren't part of distribution (non-trivial, useful?) $BaseFile = "J406D.EXE"; $WriteSame = shift =~ /-[Ss]/; system("WZZIP -V $BaseFile >A.TMP"); open(File,"TMP.BAT"); while() { next if (!/\d+\s+\w+\s+\d+\s+\d+%/); ($OSiz,$Meth,$SSiz,$Pct,$Mo,$Da,$Yr,$Hr,$Mn,$CKSum,$Att,$File) = /(\d+)\s+(\w+)\s+(\d+)\s+(\d+)%\s+(\d\d)\/(\d\d)\/(\d\d\d\d)\s+(\d\d):(\d\d)\s+([\dabcdef]{8})\s+(\S{4})\s+(.*)$/; if ($Att !~ /D$/) { ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($File); $File =~ s/\//\\/g; if (!defined($dev)) { print "$File no longer exists.\n"; print BAT "CALL GONE \"$File\"\n"; next; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($mtime); ++$mon; $year += 1900; #Current definition of `identical' is Same size/Same date to the minute #Trivial to add Checksum, but probably of no value $OK = $OSiz == $size; $OK &&= $Yr == $year; $OK &&= $Mo == $mon; $OK &&= $Da == $mday; $OK &&= $Hr == $hour; $OK &&= $Mn == $min; if (!$OK) { print "Changed: $File\n"; print BAT "CALL CHANGE \"$File\"\n"; } elsif ($WriteSame) { print BAT "CALL SAME \"$File\"\n";} } } close(BAT);