I'm need to essentially get the summary of "DIR/s" but without listing. I want to be able to see the number of files/folders/bytes used and bytes available - and pipe all that to a file?
Asked
Active
Viewed 5,383 times
0
-
1What tools are allowed? Which version of Windows (and thus `cmd.exe`)? – 0xC0000022L Feb 28 '13 at 01:22
-
Consider using `diruse` instead of `dir`: available from http://www.microsoft.com/en-us/download/details.aspx?id=18546 – Harry Johnston Feb 28 '13 at 01:50
2 Answers
1
@echo off
setlocal EnableDelayedExpansion
for /F %%a in ('dir') do (
set files=!dirs!
set dirs=%%a
)
echo %files% Files(s), %dirs% Dir(s)
Previous Batch file may be easily modified to get the number of used and available bytes, if required.
Antonio

Aacini
- 65,180
- 12
- 72
- 108
0
While this can be done using command-line scripting it's FAR easier using PowerShell.
Without knowing what information you want to collect per folder and as a summary, it's not possible to provide a worked solution right now.
However, I'd encourage you to read through and experiment with the scripts and answers provided in the following threads:
- A PowerShell script to find the file size and file count of a folder with millions of files?
- PowerShell : how do you run a folder size summation?
- powershell folder stats
HTH.

Community
- 1
- 1

Rich Turner
- 10,800
- 1
- 51
- 68
-
Ah thanks! What I mean is this 667 File(s) 37,487,015,901 bytes 392 Dir(s) I've omitted the bytes free as it isn't really required in this instance. Even the bytes used is optional, its more the count of files and directories. Similar to what you'd see if you right-click> Properties in a windows directory. – Eddi Calaguas Feb 28 '13 at 01:24
-
@RichardTurner: I don't think that the solution to this problem be "FAR easier using PowerShell". I even think that my Batch solution is easier than any equivalent PowerShell one... – Aacini Feb 28 '13 at 05:47