Source

quotachecker /

Filename Size Date modified Message
45 B
2.3 KB
0 B
1.5 KB
1.7 KB
0 B
####################
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
   ./folder-0   4
   ./folder-1   920
   ...
   ./folder-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 folder-1 folder-2
   ./folder-1   920
   ./folder-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


Output
======

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

Each folder-quota will be sorted by names, presented in one line by default::

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


With the option ``-c`` there will be a total on the bottom of the list like so: ::

   $ qcheck -c
   ./folder-0   4
   ./folder-1   920
   ...
   ./folder-9   8248
   .            41264
   total        41264

The output can also konverted to a human readable form by the ``-r`` option::

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



file-output
-----------

If the fileoutput is enabled with the option ``-f`` the output is written to a csv-file. If no parameter for the file name is given the name of the file is "output.csv". 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 ``YYMMDD``:

.. csv-table:: Example CSV output

   folder, 111205, 120305
   folder-1, 0K, 128K
   folder-2, 32M, 132M
   folder-3, 980M, 1.124G
   total, 1.012g, 1.256g

If the *column* already exists you will be asked to choose one of the following options:

* override the column
* give a new name for the column
* cancel the writing


Requirements
============

- python2.6
- `argparse <http://pypi.python.org/pypi/argparse>`_