home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PARADIS1 / ARJHEAD3.PAS < prev    next >
Pascal/Delphi Source File  |  1992-03-27  |  4KB  |  111 lines

  1. (5255)  Sat 21 Mar 92  0:46
  2. By: Darren Lyon
  3. To: All
  4. Re: ArjDate (4/4)
  5. St:
  6. ---------------------------------------------------------------------------
  7. @EID:62fc 187505c0
  8. @MSGID: 3:690/660.4 176ec016
  9.          { Convert the filename into a Pascal string, from ASCIIZ }
  10.          I := 0;
  11.          Repeat
  12.             Inc(I);
  13.             BlockRead(ArjFile, FileName[I], 1);
  14.             Until FileName[I] = #0;
  15.          FileName[0]:=Chr(I-1);
  16.  
  17.          { Wipe a comment from the file }
  18.          Repeat
  19.             BlockRead(ArjFile, JunkByte, 1);
  20.             Until JunkByte=0;
  21.  
  22.          { Read in parts of the header information as wee need them }
  23.          BlockRead(ArjFile, HeaderCRC, 4);    { Discard... }
  24.          BlockRead(ArjFile, ExtSize, 2);      { Extended headers, not used }
  25.          if ExtSize > 0 then
  26.             Seek(ArjFile, FilePos(ArjFile)+ExtSize+4);
  27.  
  28.          { Get the file signature }
  29.          BlockRead(ArjFile, Sig, SizeOf(Sig));
  30.  
  31.          { Print a header }
  32.          Write('  Date       Time      Original    Compressed");
  33.          Writeln('   FileName');
  34.          Write('--------   --------   ----------   ----------");
  35.          Writeln('   ------------');
  36.  
  37.          { Keep repeating this until there are no more listed files }
  38.          While Sig.BasicHdrSiz>0 Do
  39.             Begin
  40.             { Read the next file header }
  41.             BlockRead(ArjFile, Hdr, SizeOf(Hdr), BytesRead);
  42.  
  43.             { Convert from ASCIIZ to Pascal string }
  44.             I:=0;
  45.             Repeat
  46.                Inc(I);
  47.                BlockRead(ArjFile,FileName[I],1);
  48.                Until FileName[I]=#0;
  49.             FileName[0]:=Chr(I-1);
  50.  
  51.             { Remove a single file comment }
  52.             Repeat
  53.                BlockRead(ArjFile, JunkByte, 1);
  54.                Until JunkByte=0;
  55.  
  56.             { Compare this file's time stamp to the highest }
  57.             If Hdr.DateTime > TopDate then
  58.                TopDate := Hdr.DateTime;
  59.  
  60.             { Print some information about the file }
  61.             WriteDate(Hdr.DateTime);
  62.             Write('   ');
  63.             Write(Hdr.OrigSize:10, '   ', Hdr.CompSize:10, '   ', FileName);
  64.             Writeln;
  65.  
  66.             { We now have one more file... }
  67.             inc(FileCount, 1);
  68.  
  69.             { Discard the rest of the header, and the actual file data }
  70.             BlockRead(ArjFile,HeaderCRC,4);
  71.             BlockRead(ArjFile,ExtSize,2);
  72.             Seek(ArjFile,FilePos(ArjFile)+Hdr.CompSize);
  73.             BlockRead(ArjFile,Sig,SizeOf(Sig));
  74.             End;
  75.  
  76.          { We have listed all of the Arj files, print last date }
  77.          Writeln;
  78.          Writeln('A total of ', Filecount, ' files counted...');
  79.          Write('Latest Date/Time stamp was: ');
  80.          WriteDate(topdate);
  81.  
  82.          { Set the new file date and time }
  83.          Reset(ArjFile);
  84.          SetFTime(ArjFile, TopDate);
  85.          close(ArjFile);
  86.          end;
  87.  
  88.       { Go ahead and find the next file matching the parameters }
  89.       Writeln;
  90.       FindNext(DirInfo);
  91.       end;
  92.  
  93. End.
  94.  
  95. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  96.  
  97.    I hope everyone finds this code useful! I have a hundred or so megs
  98. worth of archives stored on disks, and almost all of them had the same
  99. 1991 dates. So I wrote this, and just ran 'ArjDate *' on each disk... It is
  100. amazing how long ago some of that stuff was written! :-)
  101.  
  102. Cheers,
  103.    Darren
  104.  
  105.  
  106. --- msgedsq 2.0.5
  107.  * Origin: Programming - the art of re-inventing wheels! (3:690/660.4)
  108.  
  109. @PATH: 6600/4 690/660 601 644 640/821 209/209 396/1 170/400 512/0 
  110. @PATH: 512/1007 
  111.