filesack - pack a medium with files to the maximum
filesack { size | -c | -d } file ...
The filesack program finds one or more subsets of files or directories with the maximum total size not exceeding a given size. Its output looks as follows:
size file file file size file file ...
The total size of files under each size adds up to the size printed immediately before the file names, and all sizes are the same and as large as possible, yet no larger than the maximum total size.
Maximum total size (in kilobytes).
Use the size of a CD, which is 665600 Kb (which equals 650 Mb).
Use the size of a DVD, which is 4589843 Kb. This value is the closest to 4,700,000,000 bytes, which is close to the actual capacity of a 4.7 GB DVD media.
Suppose you have a collection of MP3 albums, and you want to burn them to a CD, and you want to fill up the CD as much as possible.
filesack -c Albums/*
But if you have a 700 Mb CD-R:
filesack 716800 Albums/*
The du(1) utility.
Alexander Anderson <a.anderson@utoronto.ca>
Copyright (c) 2004 Alexander Anderson. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Algorithm::Knapsack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm::Knapsack
CPAN shell
perl -MCPAN -e shell install Algorithm::Knapsack
For more information on module installation, please visit the detailed CPAN module installation guide.