# Getting Folder Sizes

Folks often ask how to use PowerShell to get the size of a folder, such as a user home folder.

Problem is, \_folders don't have a size. \_Windows literally doesn't track size for folder objects. A folder's "size" is merely the sum of it's files' sizes. Which means you have to add them up.

```
Get-ChildItem -Path <whatever> -File -Recurse |
Measure-Object -Property Length -Sum
```

As one example. Bottom line, you need to get all the files, and add up their Length properties.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devops-collective-inc.gitbook.io/the-big-book-of-powershell-gotchas/getting-folder-sizes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
