This program uses the first-fit decreasing size strategy to try to pack the argument files into as few directories as possible. You can set the capacity of each bin, run it without actually packing (for statistical purposes) and handle directories as well as regular files.
$ python binpack.py -p *.jpg
# cd0 : 699M full, 19K remaining
# cd1 : 699M full, 47K remaining
# cd2 : 699M full, 65K remaining
# cd3 : 205M full, 494M remaining
To learn more, read the documentation in the code or simply run python binpack.py -h