Repository navigation
Command Line and CSV
WinDirStat can scan targets from the command line, save scan results to CSV or JSON, load saved results, and export duplicate and permission reports.
WinDirStat.exe C:\PathToScan
WinDirStat.exe C:\ D:\
WinDirStat.exe "\\server\share\folder"
WinDirStat.exe "C:\First Folder" "D:\Second Folder"
Quote paths that contain spaces. Multiple drive or folder paths can be supplied to scan more than one target.
The operation flags below are case-insensitive and accept / or - prefixes. Use one save/load operation per invocation,
place its output or input filename immediately after the flag, and supply scan targets for save operations.
WinDirStat.exe /SaveTo C:\Reports\scan.csv C:\PathToScan
WinDirStat.exe /SaveTo C:\Reports\scan.json C:\PathToScan
This scans without showing the main window, writes the scan tree, and exits. Duplicate detection is disabled for this
mode. A .json extension selects JSON; other extensions use CSV. Use .csv or .json to make the format explicit.
Create the destination folder before running the command.
The scan uses current saved settings, including filters, hidden/protected exclusions, reparse-point exclusions, thread count, and accelerated scanning when available. Running elevated may change which files can be scanned.
WinDirStat.exe /SaveDupesTo C:\Reports\duplicates.csv C:\PathToScan
WinDirStat.exe /SaveDupesTo C:\Reports\duplicates.json C:\PathToScan
This scans with duplicate detection enabled, writes duplicate groups, and exits. It can take much longer than a normal scan because file contents must be hashed. The configured hash algorithm and duplicate-detection exclusions apply.
If sparse hashing is enabled, files larger than 64 MiB are sampled. Matching samples are duplicate candidates rather than full-content matches. Exports include a Sampled hash field so scripts can distinguish them. See Search, Filters, and Duplicates before acting on these reports.
WinDirStat.exe /SavePermsTo C:\Reports\permissions.csv C:\PathToScan
WinDirStat.exe /SavePermsTo C:\Reports\permissions.json C:\PathToScan
This scans the targets, reads accessible permission entries, writes a permission report, and exits. The account-exclusion expression in Options > Settings > Permissions also applies. This operation does not override the saved duplicate-detection setting; turn duplicate detection off beforehand if it is unnecessary.
In the interface, finish the normal scan, choose Tools > Scan Permissions, then use File > Save Permissions To CSV/JSON.... See Advanced Topics for scope and inheritance details.
WinDirStat.exe /LoadFrom C:\Reports\scan.csv
WinDirStat.exe /LoadFrom C:\Reports\scan.json
This opens a previously saved scan tree without rescanning the disk. Do not add scan targets to /LoadFrom.
Duplicate and permission exports are reports, not scan trees, and cannot be reopened through this option.
Loaded results are a snapshot and do not update automatically when files change.
Keep WinDirStat's export structure and use the same interface language that produced the file. Column names and JSON keys are localized. The JSON loader expects WinDirStat's line-oriented layout; arbitrary compacted or restructured JSON is not an interchangeable input format. UTF-8 inputs with or without a byte-order mark (BOM) are accepted.
Multi-root scans and MTP scan trees can also be saved and loaded.
Save modes exit with:
| Code | Meaning |
|---|---|
0 |
The report was written successfully. |
1 |
The operation could not complete, including invalid save arguments or a failed output write. |
A successful export does not mean every file was accessible. Scan filters, permissions, and files changing during a scan can affect the result. Provide valid targets and an existing output directory for unattended use.
WinDirStat is a Windows GUI application. In PowerShell, wait for it explicitly when the next step needs the output:
$scanArguments = '/SaveTo "C:\Reports\scan.json" "C:\Data Folder"'
$scanProcess = Start-Process 'WinDirStat.exe' -ArgumentList $scanArguments -WindowStyle Hidden -Wait -PassThru
$scanProcess.ExitCodeCSV files contain a header followed by rows. JSON files contain a flat array of objects rather than a nested directory
tree. Output text is UTF-8 without a BOM. Sizes are integer bytes and timestamps use UTC YYYY-MM-DDTHH:MM:SSZ.
The field names below are for the English interface; other interface languages translate the headers and JSON keys.
| Field | Contents |
|---|---|
Name |
Full item path, or the synthetic multi-root container's display name. |
Files |
File count beneath the item. |
Folders |
Folder count beneath the item. |
Logical Size |
Content size in bytes. |
Physical Size |
Physical allocation in bytes, with export-specific hardlink accounting described below. |
Attributes |
WinDirStat's formatted file-attribute text. |
Last Change |
Last-change timestamp; folder values reflect the scanned tree. |
WinDirStat Attributes |
Internal item type and flags as hexadecimal text, needed to reload the tree. |
Index |
File index as hexadecimal text. |
Owner |
Included only when the file-tree Owner column is visible. |
The exporter writes parents before descendants and orders siblings by name. It omits the synthetic <Hardlinks> entry
and restores per-path physical allocation to exported tree totals. Summing linked paths therefore need not equal the
unique disk space used. Preserve the internal fields and parent-before-child order if the file will be reloaded.
MTP indices are exported as zero because their live identifiers belong to the running process. MTP physical sizes
repeat the device-reported content sizes; they are not measured disk allocations.
| Field | Contents |
|---|---|
Hash Prefix |
Hash value identifying the duplicate group. |
Name |
File path. |
Logical Size |
File content size in bytes. |
Physical Size |
File physical allocation in bytes. |
Last Change |
Last-change timestamp. |
Attributes |
Formatted file-attribute text. |
Sampled hash |
true for a sparse-hash candidate; false for a full-content hash. |
Duplicate rows are ordered by logical size descending, then hash, then path. The Sampled hash field is a
JSON boolean and the text true or false in CSV.
| Field | Contents |
|---|---|
Name |
File or folder path. |
Account |
Account name for the permission entry. |
Access |
Allow or Deny. |
Rights |
Full Control, Modify, Read & Execute, Read, Write, or Special. |
Applies To |
File/folder inheritance scope of the entry. |
Access Mask |
Numeric access mask as hexadecimal text. |
Inherited |
Yes when inheritance is enabled on the item, No when its DACL is protected. |
Permission reports contain inherited and explicit entries at scan roots, and explicit entries on descendants. Inherited describes the item's inheritance setting, not the origin of an individual entry. Account exclusions and unreadable security descriptors can omit rows. Permission value labels are also localized.
Exported files are reports. They are not backups of file contents or restorable security descriptors.
Filters are saved settings. Command-line scans use the currently configured filters.
For example, if Folder paths to include contains V:\Projects\WinDirStat, this command applies that include rule
while scanning V:\:
WinDirStat.exe /SaveTo C:\Reports\windirstat-project.csv V:\
Clear filters before running broad automated scans. Size and age comparisons and the option to exclude Dropbox ignored items also affect command-line results.
Website | Blog | Repository | Releases | Issues
Wiki content is maintained for the WinDirStat project and is available under the GNU Free Documentation License 1.3.