Diskusage.exe als alternatief voor TreeSize of WizTree
Geplaatst: 15 sep 2021 15:21
Met tools als TreeSize of WizTree kan je eenvoudig mappen opsporen die veel schijfruimte in beslag nemen. Vanaf build 21277 beschikt Windows 10 over de command line tool Diskusage.exe waarmee dit ook mogelijk is. Deze tool is via de opdrachtprompt met diverse parameters te gebruiken, hieronder enkele voorbeelden.
Diskusage werkt op basis van bytes, wil je een overzicht van mappen groter dan 2GB weergeven die je dit in bytes op te geven. Hieronder een tabel met een aantal voorbeelden. De aantallen heb ik voor het gemak afgerond. Want 1GB is om precies te zijn 1073741824 bytes groot, maar dergelijke getallen opgeven maakt het enkel maar lastiger dan ronde getallen.
Bytes vs Gigabytes
Om een overzicht te krijgen van alle mappen die groter dan 2GB zijn gebruik je de parameter /minFileSize. De parameter /h staat voor humanReadable en betekent dat de grootte ook in MB of GB zal worden weergeven. Deze parameter is ook voluit te gebruiken /humanReadable. De schijfletter aan het einde van de commandoregel zal voor zich spreken. Middels het tweede commando kan je de output van de tool weg laten schrijven naar een tekstbestand op het bureaublad.

Middels de onderstaande twee commando's is er een overzicht van de vijf grootste mappen en bestanden weer te geven. Uiteraard is het aantal weer te geven items aan te passen door een ander aantal op te geven.

Overzicht parameter Diskusage.exe
/a /systemFile[:N] displays size for system files (and optionally the top N system files by SizeOnDisk in descending order)
/b /reserved displays size for reserved space
/c /csv displays in csv format
/d /maxDepth:N displays directory information only if it is N or fewer levels below command line argument
/e /minFileSize:SIZE displays directory information only if its FileSize is greater or equal than SIZE
/f /minSizeOnDisk:SIZE displays directory information only if its SizeOnDisk is greater or equal than SIZE
/g /displayFlag:FLAG specifies the flags value to determin which column(s) to display
/h /humanReadable displays size in human readable format
/i /iniFile:FILE takes all the parameters from an INI file. NOTE: SCENARIO name must be speificed via /j (/scenario)
/j /secnario:SCENARIO specifies the scenario name for the INI file
/l /allLinks count all hardlinks separately (By default, files with multiple hardlinks are counted only once towards the first link name)
/m /multipleName count only files with more than one link names
/n /nameFilter:FILTER count only files whose name matches the name filter
/p /preferredPath:PATH count files with multiple link names towards the first link that's under PATH if it exists (To query with multiple preferred paths, separate with \",\", e.g. /p:D:\path1,D:\path2) NOTE: This options must not be specified togerther with /l (/allLinks)
/q /virtual recurse into virtual directories
/r /skipReparse skip recursing into reparse directories
/s /skipResurse skip recursing into child directories when calculating sizes
/t /TopDirectory:N displays Top N directories by SizeOnDisk in descending order
/u /TopFile:N displays Top N files by SizeOnDisk in descending order
/v /verbose displays verbose error information
/x /clearDefault do not display the default selected columns
Diskusage werkt op basis van bytes, wil je een overzicht van mappen groter dan 2GB weergeven die je dit in bytes op te geven. Hieronder een tabel met een aantal voorbeelden. De aantallen heb ik voor het gemak afgerond. Want 1GB is om precies te zijn 1073741824 bytes groot, maar dergelijke getallen opgeven maakt het enkel maar lastiger dan ronde getallen.
Bytes vs Gigabytes
Bytes (B) | Gigabytes (GB) of Megabytes (MB) |
---|---|
2000000000 | 2 GB |
500000000 | 500 MB |
10000000 | 10 MB |
Om een overzicht te krijgen van alle mappen die groter dan 2GB zijn gebruik je de parameter /minFileSize. De parameter /h staat voor humanReadable en betekent dat de grootte ook in MB of GB zal worden weergeven. Deze parameter is ook voluit te gebruiken /humanReadable. De schijfletter aan het einde van de commandoregel zal voor zich spreken. Middels het tweede commando kan je de output van de tool weg laten schrijven naar een tekstbestand op het bureaublad.
Code: Selecteer alles
diskusage /minfilesize:2000000000 /h C:\
diskusage /minfilesize:2000000000 /h C:\ > "%userprofile%\desktop\diskusage.txt"

Middels de onderstaande twee commando's is er een overzicht van de vijf grootste mappen en bestanden weer te geven. Uiteraard is het aantal weer te geven items aan te passen door een ander aantal op te geven.
Code: Selecteer alles
diskusage /t=5 /h C:\
diskusage /u=5 /h C:\

Overzicht parameter Diskusage.exe
/a /systemFile[:N] displays size for system files (and optionally the top N system files by SizeOnDisk in descending order)
/b /reserved displays size for reserved space
/c /csv displays in csv format
/d /maxDepth:N displays directory information only if it is N or fewer levels below command line argument
/e /minFileSize:SIZE displays directory information only if its FileSize is greater or equal than SIZE
/f /minSizeOnDisk:SIZE displays directory information only if its SizeOnDisk is greater or equal than SIZE
/g /displayFlag:FLAG specifies the flags value to determin which column(s) to display
Code: Selecteer alles
column value description
SizeOnDisk 0x001 the on disk size
FileSize 0x002 the end of file size
SizePerDir 0x004 sum of SizeOnDisk for top level child
Files 0x008 number of child files
ChildDirs 0x010 number of child directories
FilesPerDir 0x020 number of top level child files
DirsPerDir 0x040 number of top level child directories
CreationTime 0x080 file creation timestamp
LastAccessTime 0x100 file last access timestamp
LastWriteTime 0x200 file last write timestamp
Attributes 0x400 file attributes
/i /iniFile:FILE takes all the parameters from an INI file. NOTE: SCENARIO name must be speificed via /j (/scenario)
/j /secnario:SCENARIO specifies the scenario name for the INI file
/l /allLinks count all hardlinks separately (By default, files with multiple hardlinks are counted only once towards the first link name)
/m /multipleName count only files with more than one link names
/n /nameFilter:FILTER count only files whose name matches the name filter
/p /preferredPath:PATH count files with multiple link names towards the first link that's under PATH if it exists (To query with multiple preferred paths, separate with \",\", e.g. /p:D:\path1,D:\path2) NOTE: This options must not be specified togerther with /l (/allLinks)
/q /virtual recurse into virtual directories
/r /skipReparse skip recursing into reparse directories
/s /skipResurse skip recursing into child directories when calculating sizes
/t /TopDirectory:N displays Top N directories by SizeOnDisk in descending order
/u /TopFile:N displays Top N files by SizeOnDisk in descending order
/v /verbose displays verbose error information
/x /clearDefault do not display the default selected columns