Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We basically have ~250 users all running a mix of Windows XP and 7. All our users have been asked to place all their important files in a folder on their desktop called "Backup".

I basically need to figure out a way of calculating what the total size of all these folders amount to.

Any ideas? Programs? Scripts?


share|improve this question

What you have, basically, is two high-level problems:

  1. How to get the recursive size of a folder and all its contents (including sub-folders).
  2. How to solve problem #1 across a large number of machines on a network.

To solve #1, I suggest the easiest way is to use the du utility. This is a UNIX command-line utility that has a windows port; Grab it from:

By default, du recursively scans from the current directory and prints the sizes and names. What you want is the summary as if you right-clicked the folder and did properties. So run it like this du -s Note the output is in bytes which is convenient for Excel work.

To solve #2 I suggest that you map a network drive to each computer in turn, run the du command (but appending to a file) and then do a sum in Excel. The du command will look like this: du -s >> backupSize.txt by default, the du output columns are tab-separated which imports easily into Excel.

You will have to solve the details of getting all those folders shared, making sure all the machines are available on the network, writing a batch file with a foreach style loop, and summing in Excel.

share|improve this answer
I used to use Perl to recursively sum and display sorted totals. I imagine that this can also be done in any scripting language you are familiar with (VB, Python, ...) – RedGrittyBrick Nov 18 '10 at 17:02
Yea, in windows one could write a vbscript easily enough, but not writing anything is even easier. :) – JGurtz Nov 18 '10 at 17:07
Mapping the network drives might not be necessary if he has administrative permissions. You can just run du against the shares directly, e.g. \\workstation\c$\users\username\desktop. I imagine the challenge being to enumerate the user accounts on each workstation and then running du against every user profile. Personally I'd use Perl in combination with 'du'. – Lucky Luke Jun 1 '11 at 13:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.