Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Folder Quota Checker

This program returns the quota of 1st level sub directories in a directory using the du command (available on all *nix platforms).

Usage

If no start directory is given all directories in the current one will be checked by default:

$ qcheck
./directory-0   4
./directory-1   920
...
./directory-9   8248
.            41264

Choose directories

Sometimes it is required to get the quota of a defined subset of directories.

It is possible to give folder names as arguments:

$ qcheck directory-1 directory-2
./directory-1   920
./directory-2   120

This method only makes sense for a couple of directories. Longer folder lists can be passed as a text file containing one folder per line. Pass the filename of the text file to the program using the -t argument:

$ qcheck -t folder_set.txt

Output

By default the result is written to the standard output, size is denoted in bits.

Each directory-quota will be presented in one line:

$ qcheck
./directory-0   4
./directory-1   920
...
./directory-9   8248
.            41264

The output can also converted to a human readable form with the -r argument:

$ qcheck -r
./directory-0 4,0K
./directory-1 920K
...
./directory-9 8,1M
.           41M

file-output

If the file output is enabled with the argument -f FILENAME the output will be written to a csv-file. The file will be created if it does not exist.

If the file already exists, the new content will be added as a new column to the document. The name of the column contains the date like YY-MM:

Example CSV output
directorys;2011-12;2012-03
directory-1;0K;128K
directory-2;32M;132M
directory-3;980M;1.124G

If the column already exists quotachecker will return a note that you have to set the -o parameter if you want to overwrite the column and exit. If the -o argument is set quotachecker will overwrite the column if it exists.

Requirements

If the installed Python version is at least 2.7 you have all what you need and there is nothing to install.

If the installed Python version is 2.6 or less you need to install argparse wich has already been done if you installed the quotachecker with pip.

Testing

If something doesn't work as described please first run the tests:

python runtests.py

and send me the output if it fails.

Recent activity

Frank Schneider

Commits by Frank Schneider were pushed to inqbus/quotachecker

41ea543 - Add function to check not to use foldernames from textfile and foldernames as arguments together
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.