Michael Schilli > Algorithm-Bucketizer > bucketize

Download:
Algorithm-Bucketizer-0.13.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

    bucketize - Move files into buckets

SYNOPSIS ^

    bucketize files ...

      # Make buckets 100MB in size
    bucketize -s 100m *.jpg

OPTIONS ^

-s

Set the bucket size

DESCRIPTION ^

bucketize takes a number of files and moves them into subdirectories with limited size.

These subdirectories (buckets) are created on-the-fly, and named 001, 002, and so forth.

So, if you have 8 video files like

   10570148 wienerschnitzel 02.avi
   46988832 wienerschnitzel 03.avi
    3609584 wienerschnitzel 04.avi
   76198332 wienerschnitzel 05.avi
   53203604 wienerschnitzel 06.avi
  481153928 wienerschnitzel 07.avi
  442000760 wienerschnitzel 08.avi
  292597256 wienerschnitzel 09.avi

you can ask bucketize to put them in buckets not exceeding 1GB each:

    $ bucketize -s 1g *.avi

In this case, bucketize will create the following directory structure:

  ./001:
  wienerschnitzel 02.avi  wienerschnitzel 04.avi  wienerschnitzel 06.avi
  wienerschnitzel 03.avi  wienerschnitzel 05.avi  wienerschnitzel 07.avi
  
  ./002:
  wienerschnitzel 08.avi  wienerschnitzel 09.avi

It is an error if a numbered directory already exists, make sure you start with a clean slate.

EXAMPLES ^

  $ bucketize *.jpg

  $ bucketize -s 2g *.jpg

LEGALESE ^

Copyright 2007 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR ^

2007, Mike Schilli <cpan@perlmeister.com>

syntax highlighting: