Reputation: 1828
How can I get sum of sizes of all files which are located in a directory (but exclude files in subdirectories)?
Upvotes: 1
Views: 23026
Reputation: 14361
Assuming in MS DOS: But this doesn't exclude the sub folders and hidden files ;)
Try:
dir /a/s
Result in : Files for current directory and subdirectories wih their hidden files. And total size for all of them.
PS: Frankly, there's a GUI you can get the folder size and number of files within. Curious to know why you want to do so within DOS? ;)
Upvotes: 1
Reputation: 4467
This information is included in the output of the dir-command. In the line before the last output line is the number of files and the tortal size displayed.
Upvotes: 0
Reputation: 5046
Using the dir
command, the total bytes is displayed in the next to the last line. You could use:
dir | findstr "File(s)"
To get only this information for the current directory. Or
dir path | findstr "File(s)"
to get total size in the given path, for example:
dir c:\windows | findstr "File(s)"
Upvotes: 3