aleksaan / diskusage

Duck is a very fast utility to find largest directories or files
MIT License
99 stars 12 forks source link
analyzes biggest command-line command-line-tool depth directories disk disk-space disk-usage diskusage files folder folders largest size top usage utility

DUCK - (D)isk(U)sage(CK)

Duck is a very fast utility to find largest directories or files

Illustrator: Ekaterina [t.me/@kateUV]

To Elon Musk

I hope you will see it and I have couple of quite well ideas to chat them with you.

Write to [t.me/@AngryMuscle]

Features

Releases

Releases available as single executable files – just download latest release for your platform, unpack and run.

How it works

Since version 2.8.0 utility has a two parts:

Duck_a gathers sizes of all directories and files under specific path. Duck_f takes results of Duck_a and looks for top of largest objects among them.

You can scanning 1Tb disk only once by Duck_a (some minutes) and then many times finds largest objects by Duck_f with different parameters (some milliseconds).

Duck_a utility

Duck_a calculates sizes of directories and files.

Parameters:

By default program outputs results to console.

Example a.1. Scanning from c:\temp and saving results in JSON format to results_a.txt

duck_a.exe -path c:\temp\ > .\results_a.txt

Example a.2. Scanning from c:\temp and output results in human readable format to console

duck_a.exe -path c:\temp\ -hr

Duck_f utility

Duck_f takes results of Duck_a, iterates over them and finds top largest directories or files

Parameters:

By default program outputs results to console.

Example f.1. Searching top-10 largest directories or files on depth 2 and outputing results as JSON to file

duck_f.exe -depth=2 -size=c -top=10 -filter=df < .\results_a.txt > .\results_f.txt

Example f.2. Searching top-12 largest directories or files on depth 3 and outputing results in human readable format to console

duck_f.exe -depth=3 -size=c -top=12 -filter=d -hr < .\results_a.txt

Example f.3. Like as Example f.2 but with filtering by path of file (for example, print only dir or files contains .git in their path & names)

duck_f.exe -depth=2 -size=c -top=12 -filter=d -path=.git -hr < .\results_a.txt

So there are results of Example f.3

Arguments:
   filter:    d
   depth:     3
   top:       12
   hr:        true
   size:      c
-------------------
Results:
     1.| PATH:   diskusage\.git\hooks     | FULL SIZE:    22.89 Kb   | CLEAN SIZE:    22.89 Kb   | DEPTH: 3
     2.| PATH:   statusek\.git\hooks      | FULL SIZE:    22.89 Kb   | CLEAN SIZE:    22.89 Kb   | DEPTH: 3
     3.| PATH:   statusek\.git            | FULL SIZE:   114.22 Mb   | CLEAN SIZE:     5.22 Kb   | DEPTH: 2
     4.| PATH:   diskusage\.git           | FULL SIZE:    22.67 Mb   | CLEAN SIZE:     5.08 Kb   | DEPTH: 2
     5.| PATH:   statusek\.git\logs       | FULL SIZE:     5.30 Kb   | CLEAN SIZE:     2.17 Kb   | DEPTH: 3
     6.| PATH:   diskusage\.git\logs      | FULL SIZE:     1.79 Kb   | CLEAN SIZE:   741.00 b    | DEPTH: 3
     7.| PATH:   diskusage\.git\info      | FULL SIZE:   240.00 b    | CLEAN SIZE:   240.00 b    | DEPTH: 3
     8.| PATH:   statusek\.git\info       | FULL SIZE:   240.00 b    | CLEAN SIZE:   240.00 b    | DEPTH: 3
     9.| PATH:   diskusage\.git\objects   | FULL SIZE:    22.64 Mb   | CLEAN SIZE:     0.00 b    | DEPTH: 3
    10.| PATH:   diskusage\.git\refs      | FULL SIZE:   155.00 b    | CLEAN SIZE:     0.00 b    | DEPTH: 3
    11.| PATH:   statusek\.git\objects    | FULL SIZE:   114.19 Mb   | CLEAN SIZE:     0.00 b    | DEPTH: 3
    12.| PATH:   statusek\.git\refs       | FULL SIZE:   196.00 b    | CLEAN SIZE:     0.00 b    | DEPTH: 3

Note about FULL SIZE and CLEAN SIZE

For example, if you have directories:

then CLEAN SIZE of these dirs will be: