@@ -0,0 +1,1154 @@
+#!/usr/bin/env python%0Aimport sys, os%0A%0AMAX_PACKSIZE = 1024*1024*1024%0A%0A%0Adef usage():%0A    sys.stderr.write(%22usage: kurt.py %3Cpath%3E%5Cn%22)%0A%0A%0Adef get_files(path):%0A    files = os.listdir(path)%0A    for file in sorted(files):%0A        file_path = os.path.join(path, file)%0A        file_stats = os.stat(file_path)%0A        yield (file_path, file_stats.st_size)%0A%0A%0Adef get_packs(path):%0A    singles = %5B%5D%0A%0A    packsize = 0%0A    paths = %5B%5D%0A    for path, size in get_files(path):%0A        if packsize + size %3C= MAX_PACKSIZE:%0A            paths.append(path)%0A            packsize += size%0A        elif size %3E MAX_PACKSIZE:%0A            singles.append((%5Bpath%5D, size))%0A        else:%0A            yield (paths, packsize)%0A            packsize = 0%0A            paths = %5B%5D%0A%0A            for single in singles:%0A                yield single%0A            singles = %5B%5D%0A    if len(paths) %3E 0:%0A        yield (paths, packsize)%0A%0A%0Aif len(sys.argv) != 2:%0A    usage()%0A    sys.exit(1)%0A%0Apath = sys.argv%5B1%5D%0A#TODO check if path exists%0A%0Afor index, pack in enumerate(get_packs(path)):%0A    paths, packsize = pack%0A    print %22Pack %25d (%25dB)%22 %25 (index, packsize)%0A    for path in paths:%0A        print %22  %25s%22 %25 path%0A%0A

Add first implementation sketch