Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a cmd/batch file that returns % disk space used?

654 views
Skip to first unread message

Chris Snow

unread,
Oct 11, 1999, 3:00:00 AM10/11/99
to
Does anyone have a batch file or know of a command that returns the %disk
space used?

Thanks in advance,

Please reply to my email address.

Chris.

-**** Posted from RemarQ, http://www.remarq.com/?b ****-
Real Discussions for Real People

Nicole Hamilton

unread,
Oct 11, 1999, 3:00:00 AM10/11/99
to
Chris Snow <aggi...@netscape.net> wrote:
> Does anyone have a batch file or know of a command that returns
> the %disk space used?

Yes. Here's the output of the du (disk usage) command included with
my Hamilton C shell:

30 C% du
c: 2096.160 M Total = 1622.368 M Used + 473.792 M (22.60%) Free win95
d: 1534.176 M Total = 642.642 M Used + 891.534 M (58.11%) Free winnt
e: 2047.968 M Total = 339.456 M Used + 1708.512 M (83.42%) Free
f: 6835.624 M Total = 3314.908 M Used + 3520.716 M (51.51%) Free
g: could not be accessed.
h: 617.308 M Total = 617.308 M Used + 0.000 M (00.00%) Free neast497
r: 324.545 M Total = 320.705 M Used + 3.840 M (01.18%) Free winnt
t: 860.560 M Total = 826.416 M Used + 34.144 M (03.97%) Free win95


I have it configured for my own use to list everything other than a: that's
accessible. In this example, the "30 C%" is the C shell prompt, "du" is
what I typed, the rest is output from the du utility. G: is removable drive
(actually a digital camera memory card reader) with nothing in it, c:
through f: are local hard disk drives, h: is a cdrom, r: and t: are on another
machine over my network.

As before, this is all part of the demo version you'll find on my website
(see http://www.hamiltonlabs.com/cshell.htm) though I do need to add
one caveat: If you are using FAT32, I'll need to give you the new build
of du, not yet up on my site. Just ask. (When MS introduced FAT32,
they also introduced a new Win32 api specifically to support it.)
--

Regards,
Nicki Hamilton

Nicole Ashley Hamilton KD1UJ hami...@hamiltonlabs.com
http://www.hamiltonlabs.com Phone 781-487-0008 FAX 781-487-0009
Hamilton Laboratories, 45 Kings Way, Unit 14, Waltham, MA 02451-9039, USA


Outsider (6.22/3.11)

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to Chris Snow
Chris Snow wrote:
>
> Does anyone have a batch file or know of a command that returns the %disk
> space used?
>
> Thanks in advance,
>
> Please reply to my email address.
>
> Chris.
>
> -**** Posted from RemarQ, http://www.remarq.com/?b ****-
> Real Discussions for Real People

Not in percentages. I do have one that returns one of the following.
min bytes free: 100,000,000
min bytes free: 10,000,000
min bytes free: 1,000,000
min bytes free: 100,000
min bytes free: 10,000
min bytes free: 1,000
min bytes free: 100
min bytes free: 10
min bytes free: 1

Regards,
Outsider

Outsider (6.22/3.11)

unread,
Oct 12, 1999, 3:00:00 AM10/12/99
to Chris Snow
Chris Snow wrote:
>
> Does anyone have a batch file or know of a command that returns the %disk
> space used?
>
> Thanks in advance,
>
> Please reply to my email address.
>
> Chris.

Sorry, I addressed the wrong question in my previous answer.
This will give you the number of files and disk space used,
but *not* in percentage. This returns the info for the
current directory, so if you want info for the entire drive,
you must be in the root.

Ansi.sys required; # represents the escape character,
created in edit by 'Ctrl+P Esc'.

:: howmany.bat
FOR %%v IN (D d) DO IF "%1"=="%%v" GOTO DETAILS
DIR/A-D/W/S |FIND "file(s)"|SORT/R |FIND/N "file(s)"|FIND "[1]"
IF not errorlevel=1 ECHO #[1ATotal:
GOTO end

:details
DIR/A-D/S/W|FIND "i"|FIND/V "Volume"|MORE
ECHO.
:end

HTH,
Outsider

- Ed Lin

unread,
Oct 13, 1999, 3:00:00 AM10/13/99
to
On 32-bit windows, I believe the Windows Scripting Host can do this.

If you're on win98, you already have it (and should get the security fix for
it, since a web page can use it to wipe you out.).

Steve A. Taylor

unread,
Oct 14, 1999, 3:00:00 AM10/14/99
to
Not as easy, as others have said. This batch shows directory, file
byte usage of current directory and subs, from PC magazine. Windows
Magazine has an executable "Ptdinfo.exe" that shows all drives and
stats, not percentage, in a nice message box.
---------------------
@echo off
rem * Dirsize.bat Directory/Files Space used
rem added to context menu for folders

set loc=%temp%
set dircold=%dircmd%
set dircmd=
cls
ECHO The number and size of files in and below this folder, %1, is:
DIR %1 /-B/S/V/A | FIND "bytes" /i > %loc%\files.tmp
FIND "file(s)" %loc%\files.tmp | SORT /R | FIND "bytes" /N | FIND
"[2]"
ECHO.
ECHO %1 Directory uses
FIND "dir(s)" %loc%\files.tmp /i | SORT /R | FIND "bytes" /N/i | FIND
"[2]"
DEL %loc%\files.tmp
SET DIRCMD=%DIRcOLD%
pause
:end
for %%a in (dircold loc) do set %%a=
-----------------------------------------------------------------

0 new messages