LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Record Size of each directory (https://www.linuxquestions.org/questions/programming-9/record-size-of-each-directory-196029/)

doza 06-21-2004 11:41 AM

Record Size of each directory
 
I am trying to write a script that would record the size of each of my user directories and record the output to a file to eventually be used with gnuplot. What is the easiest way to get the size of each subdirectory? For instance, I only want the total size of each individual user's directory under /home. Is there anything easier than:

(not real code, but you get the idea)
for DIR in /home/*
SIZE='du -ks $DIR'

Is a bash script the way to go? Should I use a different language?

leonscape 06-21-2004 12:28 PM

du is probably the best for this. There are ways of doing it on other languages, but it basically comes down to the same thing really.

doza 06-21-2004 12:54 PM

Thanks, that's what I figured.


All times are GMT -5. The time now is 05:35 PM.