home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / hcshdemo.zip / csh-os2.zip / SAMPLES / SIZEOF.CSH < prev    next >
Text File  |  1993-09-28  |  804b  |  20 lines

  1. #    Calculate the total space used by specified files or directories
  2. #    Copyright (c) 1992 by Hamilton Laboratories.  All rights reserved.
  3.         
  4. proc sizeof(files)
  5.     #    Method is as follows:
  6.     #    1. Get a long listing of all the files of interest, walking thru any
  7.     #        subdirectories that may have been specified.
  8.     #    2. Cut out the field 6, the column showing the space used.  (Note
  9.     #        that the space is taken delimiter and that repeated spaces are
  10.     #        ignored.)
  11.     #    3. Paste this series of numbers back on the command line with backquotes
  12.     #        and globally substitute +'s for the spaces between each pair of
  13.     #        numbers.
  14.     #    4. Run this constructed statement back thru the parser and execute
  15.     #        it with the eval statement.
  16.     eval return `ls -Lw! $files | cut -f6 -rd^ `:gS/ /+/
  17. end
  18.  
  19. sizeof $argv
  20.