home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / archiver / lsize25.zip / LSIZE.DOC < prev    next >
Text File  |  1994-01-18  |  11KB  |  226 lines

  1.  
  2. 01/18/94            LSIZE 2.5  -  Archive File Sizer
  3. -----------------------------------------------------------------------------
  4. DESCRIPTION   
  5. -----------------------------------------------------------------------------
  6. I originally wrote this program to backup very large .LZH files to floppy
  7. disks.  There were a few programs that allow you to physically split a file
  8. into parts, but these programs proved to be inconvenient.  I wanted a way to 
  9. split one archive into many smaller ones that are still readable by the 
  10. archiving program.  This eliminates the need for rejoining "split" files or 
  11. spanning a file across several floppies.  LSIZE works well for "sizing" 
  12. archives consisting of several smaller files (less than about 1Meg
  13. (compressed) each.) Remember it is impossible to "size" an archive smaller 
  14. than its largest file.
  15. I.E. If the largest file in the archive is say 4Megs and it is
  16. compressed to, say, 1Meg -then you can size the archive no smaller than 1Meg.
  17. Splitting up archives with files this large still requires splitting or 
  18. spanning.  Luckily, 99% of archives (at least the ones I work with) don't 
  19. contain files this large so this program works fine.  Finally, I was 
  20. persuaded to expand the original program to work with the popular ZIP and ARJ 
  21. formats as well as LZH.
  22.  
  23. NOTE: If you compress a single file and that file is still larger than your 
  24. target disk size - THIS PROGRAM WILL NOT WORK!  (Luckily, this is not usually 
  25. the case.)  In this case you have no other choice but to SPLIT this file 
  26. using one of the many programs for this purpose. (People using ZIP/ARJ
  27. could also create multi-volume archives with their respective spanning
  28. features)
  29.  
  30. The current version of the program should work with archives
  31. generated by:
  32.                     PKZIP version 2.04g,
  33.                     LHA   version 2.13,         
  34.                     ARJ   version 2.41, 
  35.                     and their predecessors (I think).
  36.  
  37. NOTE: This program will not split up multi-volume or spanned
  38. archives - attempting to do so can cause unpredictable results!  This
  39. program will not work with self-extracting EXE files.
  40.  
  41. -----------------------------------------------------------------------------
  42. USAGE
  43. -----------------------------------------------------------------------------
  44. USAGE: Typing LSIZE alone will produce a help screen.
  45.      
  46. Command Line:  LSIZE  SourceFileName  [TargetFileNamePrefix] MaxSize
  47.      
  48.           where  SourceFileName = name of the archive to be broken up.
  49.                  TargetFileNamePrefix = prefix of files to be created.
  50.                                       = [defaults to source name].
  51.                  MaxSize = maximum size(in bytes) of each output file.
  52.                          = also accepts sizes: 1.44M, 720K, 1.2M, 360K.
  53.                     
  54. EXAMPLES:  To split up a file called YEAR.ZIP into files that will each
  55. fit onto 720K floppy disks.
  56.                      Type:  LSIZE YEAR.ZIP  720K
  57. This would produce a number of smaller files called YEAR1.ZIP, YEAR2.ZIP,
  58. YEAR3.ZIP, ...and so on.
  59.  
  60.           To split up a file called BIG.ARJ into smaller files each called
  61. SMALLn.ZIP with a max size of 1.44M.
  62.        Type LSIZE BIG.ARJ SMALL 1.44M
  63.  
  64. Fairly straight forward - heh?
  65.  
  66. A FEW MORE THINGS:  LSIZE will never overwrite files without your permission.
  67. Should a file be placed in a position that it could be overwritten you
  68. will be prompted: overwrite? (Y/N/G)
  69.      Y means YES overwrite this file!
  70.      G means YES overwrite this file and all subsequent files if needed. 
  71.      ANSWERING WITH G MEANS YOU WILL NOT BE PROMPTED AGAIN if LSIZE needs
  72.      to overwrite another file - LSIZE WILL AUTOMATICALLY OVERWRITE!
  73.      Any other response means "NO! DO NOT overwrite!" at which point the
  74.      program is terminated and you will be returned to the DOS prompt.
  75.      
  76.      LSIZE can only handle archives with no more than 4000 files...
  77.      Provided you have the RAM!
  78.  
  79. -----------------------------------------------------------------------------
  80. TECHNICAL NOTES              HOW LSIZE WORKS
  81. -----------------------------------------------------------------------------
  82. The following describes the basic algorithm used by LSIZE.
  83.  
  84. Suppose an archive file looks like this:
  85.    
  86.    INFILE.TUT
  87.    ----------------------------------------------------------------------
  88.   | A(2k)| B(7k)| C(5k)| D(3k)| E(1k)| F(3k)| G(6k)| H(3k)| I(8k)| J(2k) |                                                    
  89.    ----------------------------------------------------------------------
  90.  
  91. The archive contains ten files named A,B,C,...J.  Each files compressed
  92. size is in parentheses. We now wish to size INFILE.TUT to smaller 10K files.
  93. So we type  LSIZE INFILE.TUT OUTFILE 10000  on the command line.
  94. LSIZE reads through the archive and stores each file name in an array along 
  95. with its compressed size, and its relative position in the archive.  Once all 
  96. the files are read, this array is sorted in decreasing order by file size.  
  97. So now our array would look like this:
  98.      
  99.      I8, B7, G6, C5, D3, F3, H3, A2, J2, E1.
  100.  
  101. For simplicity: I'll call the 2K 'A' file, 'A2'; the 7K 'B' file, 'B7', and
  102. so on.  These files are now 'sized' to subfiles.  We'll begin with subfile
  103. #1.  We must now determine which of the files will be placed in OUTFILE1.  
  104. LSIZE begins by searching the array for the largest file that will fit into 
  105. the target file size.  In this case we want 10K files.  So file I8 will be 
  106. the first file in OUTFILE1.  We now mark off file I8 in the array as 
  107. belonging to subfile #1.  File I8 will now be eliminated from further 
  108. searches.  We now look for the next largest file in the array that will fit
  109. into OUTFILE1 without causing it to go over 10K.  This would be file A2.
  110. OUTFILE1 now will contain files I8 and A2.  Note that OUTFILE1 has reached
  111. its 10K limit and no more files can be placed in it.  Now we begin placing 
  112. files into OUTFILE2.  The next largest file is B7 and it is marked for
  113. OUTFILE2.  The next largest file that will fit is D3.  OUTFILE2 has now
  114. reached the 10K limit.  This process of assigning files into subfiles 
  115. continues until all the files have been assigned.  The final subfile 
  116. assignments look like this:
  117.  
  118.  OUTFILE1          OUTFILE2           OUTFILE3          OUTFILE4
  119.  --------          --------           --------          --------
  120.     I8                B7                 G6                C5
  121.     A2                D3                 F3                H3
  122.                                          E1                J2
  123.  
  124. Each of these subfiles is then written out to disk and this simple example is 
  125. complete.  In reality, there is header information that is also contained 
  126. within each archive that must be accounted for when sizing.  Making matters
  127. worse these header sizes grow larger each time another file is assigned to
  128. a subfile archive.  
  129.  
  130. ----------------------------------------------------------------------------
  131. LEGAL STUFF
  132. ----------------------------------------------------------------------------
  133.      I am releasing this program into the public domain.  There are no 
  134.      licenses to buy or fees to pay.  (Of course, if you insist -you can
  135.      send a donation to the address below!)  There are also no guarantees 
  136.      of any kind.  USE THIS PROGRAM AT YOUR OWN RISK.  You may distribute 
  137.      this program freely provided that this file is included and the  
  138.      program itself is unmodified.  The only thing I ask is that you send 
  139.      your comments, suggestions, or bug reports to me at:
  140.      
  141.      L.S. Lewis                               email to
  142.                                               (Internet):
  143.      15 Marigold Lane              OR         larrylw@eden.rutgers.edu
  144.      Willingboro, NJ 08046-2812               <note: This account will                                          
  145.                                               probably be closed as of
  146.                                               summer 1994 - I'm graduating!
  147.                                               Anyone need a good computer
  148.                                               engineer?>  
  149.  
  150. -----------------------------------------------------------------------------
  151. LSIZE HISTORY
  152. =============================================================================
  153.  
  154. Ver 2.50   1-18-94
  155. -----------------------------------------------------------------------------
  156. Modified output buffering to increase speed (up to 30% faster). 
  157. Added routine to REALLY truncate output subfile prefixes that are too long.
  158.    (I thought I fixed that a long time ago...but...)
  159. Added routine to pad zeroes as necessary to subfile numbers in filename.
  160. Spruced up the documentation.
  161.  
  162.  
  163. Ver 2.40   1-7-94
  164. -----------------------------------------------------------------------------
  165. Ver 2.30 was inadvertently compiled with the small memory model and would
  166. bomb on larger archives.
  167. Ver 2.40 is compiled with the CORRECT compact model.
  168. Added more efficient dynamic memory allocation for file names.
  169. Fixed bug so that LSIZE can handle all archives with up to 4000 files
  170.      -if you have the memory.
  171. Improved error messages.
  172. Added header information for the various archives as comments in source code.
  173.  
  174.  
  175. Ver 2.30   1-1-94
  176. -----------------------------------------------------------------------------
  177. Fixed bug that caused file error when sizing out to over 15 subfiles.
  178. Special thanks to David DeSimone for pointing out this bug to me.
  179.  
  180.  
  181. Ver 2.20   11-10-93
  182. ----------------------------------------------------------------------------
  183. Changed from small to compressed memory model.
  184. Fixed bug that caused the first file sized from an ARJ to report the wrong
  185. file size.
  186.  
  187.  
  188. Ver 2.10    9-24-93
  189. ------------------------------------------------------------------------
  190. Fixed file_name length bug.  File names longer than 16 chars bombed the 
  191. program.  Any file with a path is usually this length.
  192. Updated program for use with ZIP 2.04g, ARJ 2.41a, and LHA 2.13.
  193. Updated screen I/O to handle longer file names/paths.
  194. Note: LSIZE won't work with multi-volume zips(spanning)!
  195.  
  196.  
  197. Ver 2.00   12-30-92
  198. ----------------------------------------------------------------------
  199. Added code to handle ZIP 1.10 and ARJ 2.31 archive formats!!
  200. LSIZE now handles LZH/ARJ/ZIP formats.
  201. Updated some screen I/O.
  202. Toyed with idea of compiling the code for i386 for better speed.
  203. Kept 8086 instruction set for full compatibility.
  204.  
  205.  
  206. Ver 1.20       6-06-92
  207. ------------------------------------------------------------------
  208. Path handling has been improved.  The output prefix parameter has been
  209. made optional.  The default is the source name.  The prefix is truncated
  210. if it exceeds 7 letters.   
  211.  
  212.  
  213. Ver 1.10   5-15-92
  214. -------------------------------------------------------------
  215. Lsize now reports each file's size as it writes.
  216. The final size of each output file is also reported.
  217. The program now recognizes 1.44M, 1.2M, 720K, and 360K as maximum
  218. sizes on the input line.
  219.  
  220.  
  221. Ver 1.0     1-92
  222. -----------------------------------------------------------------
  223. The original program.
  224.  
  225. =============================================================================
  226.