[plug] bash scripting problem

James Devenish devenish at guild.uwa.edu.au
Fri Aug 8 14:52:45 WST 2003


In message <courier.3F334690.000024E0 at wasp.net.au>
on Fri, Aug 08, 2003 at 02:43:28PM +0800, David Buddrige wrote:
> I am trying to write a bash script that will give me the size of each of the
> directories in a given directory.  However, I only want the size of the 
> directories that are at the first level. 

So...you want a single figure that includes all subdirectories and their
contents. So, conceptually, you want the size all files within the
subdirectories of the current directory but not including the size of
any files in the current directory? The thing that springs to mind is

du -c *(/)

This is for zsh and it means "do du for each subdirectory and show the
grand total". I'm not sure what bash's equivalent for (/) is. You could
resort to using `find`, if necessary.




More information about the plug mailing list