Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Find free disk space from command line?

Jun 20, 2007 5:16AM PDT

Does anyone know of a quick and simple way to get the amount of free disk space left on the HDD in WinXP Home? I need to use a batch file to monitor and record the remaining disk space at regular intervals.

Thanks,
~Chris

Discussion is locked

- Collapse -
dir command
Jun 20, 2007 5:30AM PDT

At the end of every dir listing, there will be a line like the following:

9 Dir(s) 1,617,453,056 bytes free

You just need to figure out a way to scrape that info from within your program. Of course if you used a language like Perl, Python, or Ruby, there would likely be a built-in function for doing this... Or at the very least, it would be considerably easier to use regular expressions to extract just the bit of data you want.

- Collapse -
Example one liner.
Jun 20, 2007 5:31AM PDT

DIR | FIND "free"

- Collapse -
why not use freedisk.exe
Jul 2, 2007 12:54AM PDT

why not use freedisk.exe included in RK for server systems? Works well for xp too.

- Collapse -
fsutil volume diskfree C:
Feb 2, 2009 8:53PM PST

My apologies for bringing this post back from the dead, but it does display in the top 3 in many google searches:

the solution:

fsutil volume diskfree C:

which returns something like:

Total # of free bytes : 230645665792
Total # of bytes : 266205130752
Total # of avail free bytes : 230645665792

- Collapse -
cygwin compatibility freespace diskspace volumes
Aug 23, 2011 12:49AM PDT

Thanks for this. I found fsutil output is compatible with a cygwin command line, so I was able to use this via ssh and sshd. As elegant as wmic capabilities are; it doesn't send it's output to the console through the normal output method, and so normal console utils won't interact with it's output.

Many thanks

- Collapse -
wmic command to monitor remote PC
Mar 2, 2011 1:51AM PST