home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!pacbell.com!ptsfa!dmturne
- From: dmturne@ptsfa.PacBell.COM (Dave Turner)
- Subject: Re: How to total file sizes for selected files?
- Reply-To: dmturne@PacBell.COM (Dave Turner)
- Organization: Pacific * Bell, San Ramon, CA
- Date: Wed, 30 Dec 1992 08:31:26 GMT
- Message-ID: <1992Dec30.083126.26511@ptsfa.PacBell.COM>
- References: <103335@netnews.upenn.edu> <1992Dec29.144421.23845@news.eng.convex.com>
- Lines: 30
-
- From the keyboard of gasser@eniac.seas.upenn.edu (Nathan Gasser):
- :I'm wondering how to print the total size for only selected files.
- :For example, "du" gives the total space occupied by all files in
- :this directory. I want only those files, say, that end in .zip.
- :
- :% du
- :. 2883
- :
- :% du -s *.zip
- :123 file1.zip
- :188 arc2.zip
- :13 game.zip
- :
- :See, what I want is for the above example to print the total
- :space for the .zip files, ie. 324.
-
- Assuming find -ls output resembling this:
-
- (inum block mode links user group bytes mtime name)
- 38976 544 -rw-rw-r-- 1 tchrist swtools 531409 Dec 15 1989 ./etc/hosts
-
-
- You might try wc:
-
- wc -c *.zip | sed -n '$p'
-
-
-
- --
- Dave Turner (510) 823-2001 {att,bellcore,sun,ames,decwrl}!pacbell!dmturne
-