File System Scanner (FSS): Find folder size & search your file system from command line

Finding out folder sizes from the command-line in a convenient manner continues to be a challenge, so here is a nifty little tool from Dumblebots to do just that.

AgFileSystemScanner (abbreviated to fss) is a command-line application for Windows (x86-64) and Linux (x86-64) to do that and more.

By default, fss gives you a listing of the directories from which it is invoked along with a summary of the file and symlinks, similar to the dir and ll commands. You can additionally get the last modification times and permissions (POSIX-style only) of each file, symlink and sizes of directories/folders (calculated recursively as the sum of the sizes of everything inside them). Instead of printing all entries, a pattern can be given and one of three search types can be specified to only print those entries that match the pattern.

You can specify the folder on which to scan, either with its absolute or relative path.

Running on Current Directory
Running on root

To run on current folder –

fss

To run on parent folder –

fss ..

To run on any folder (including root) –

fss /

fss provides additional options as follows –

  • To expand and scan recursively, specify -r or --recursive. The maximum depth can be provided as the next argument.
  • To expand and show all files, specify -f or --files.
  • To expand and show all symlinks, specify -l or --symlinks.
  • To expand and show all other types of files, specify -s or --special.
  • To show the permissions of each entry, specify -p or --permissions.
  • To show the time of last modification of each entry, specify -t or --modification-time.
  • To recursively calculate and show the sizes of all directories, specify -d or --dir-size.
  • To show the full path (from root) of each entry, specify -a or --abs.

Certain files and folders that are normally not accessible by the user (normally managed by the OS) may not be accessible to fss either, depending on the permissions of the directory and the privileges of the user invoking fss. Errors encountered while attempting to navigate such directories are normally hidden and can be views by specifying either the -e or –show-err flags.

fss can also be used to search for files, symlinks and directories, either by strictly matching the entire name with a pattern, matching the name without extension to the pattern or checking if the name contains the pattern. For example –

To find all files, folders in the current path whose name contains temp along with their sizes –

fss -d --contains temp

To find all files inside /usr/home, including sub-directories whose name exactly matches answer.txt along with their permissions and last modification times –

fss /usr/home -r -f -p -t -S answer.txt

To find all symlinks inside /usr/bin, including two levels within sub-directories whose name (not including the extension) matches test.

fss /usr/bin -r 2 -l --search-noext test

Since fss is a command line tool, sometimes the output may be too large to view in the terminal. To solve this, the output can be redirected to a text file, which can be opened by any editor to analyze the output. For example –

To completely scan through the C: drive on Windows and output the result to a text file –

fss c:\ -r -f -l -s -d > result.txt

The file will be created on the current path (path on which program was run) unless otherwise specified.

To see a summary of the usage instructions and list of options, use the -h or --help flags.

We hope that you find it useful. You can mail any comments and suggestions to aditya.agarwal@dumblebots.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s