LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-21-2004, 11:41 AM   #1
doza
Member
 
Registered: Jan 2004
Distribution: Redhat
Posts: 31

Rep: Reputation: 15
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?
 
Old 06-21-2004, 12:28 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
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.
 
Old 06-21-2004, 12:54 PM   #3
doza
Member
 
Registered: Jan 2004
Distribution: Redhat
Posts: 31

Original Poster
Rep: Reputation: 15
Thanks, that's what I figured.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to know the size of a directory? kornerr Linux - General 4 06-30-2005 09:59 AM
Directory size Carl-Fredrik Linux - Software 1 10-25-2004 03:28 PM
directory size chandan Linux - General 3 06-26-2003 08:51 AM
directory size santoshgnag Linux - General 1 06-26-2003 04:00 AM
how could I know the directory size gsbarry Linux - General 4 03-07-2003 08:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration