Source

quotachecker /

Filename Size Date modified Message
quotachecker
tests
1.0 KB
32 B
81 B
1.5 KB
116 B
2.6 KB
84 B
182.8 KB
90 B
1.9 KB

Folder Quota Checker

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

Usage

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

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

Choose folders

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

It is possible to give foldernames as arguments:

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

This method only make sense for a cupple of folders. A greater folderlist can be given by a textfile. The foldernames shoud be written line by line in the textfile. To use it give the option -t and than the filename like this:

$ qcheck -t folder_set.txt

If the folder dosent exist a "DoesentExistException" will show you that for every missing Folder.

Output

By default the result is written to the standard output in bit-format.

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 option:

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

file-output

If the fileoutput is enabled with the option -f FILENAME the output wil be written to a csv-file. The file will be created if it does not exists.

If the file already exists, the new content will be saved as a new column in 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 the quotachecker will return a note that you have to set the -o parameter if you whant to overwrite the column and exit. If the -o option is set quotachecker will overwrite the column by if it exist.

Requirements

If the installed python is atleast 2.7 you have all what you need and there is nothing to install.

If the installed python is 2.6 you need to intall argparse witch is alredy done if you installed the qotachecker with pip.

Teststing

If something dont work as describet please first run the tests:

python runtests.py

ad send me me the output if it fails.