On 11/8/05, Dave <[EMAIL PROTECTED]> wrote: > I recently lost a drive that had not very important data on it. Mostly > my ripped CD's and some downloads. Now that I'm in the process of > re-ripping my CD's I've noticed they are a bit more important than I > thought lol > > Once I've ripped them I'd like to put them on CD. I know there are > scripts that will back up entire HD's straight to CD, but I'd rather > just have them sorted into directories that are no bigger then a CD > and I'll just burn them later. Anyone know of a script that takes a > bunch of files and moves them around into directories that have a size > limit?
This is a classic mathematics problem known as the "bin packing problem". For a few words on the subject, see < http://en.wikipedia.org/wiki/Bin_packing_problem >. For a page full of math-speak, see < http://www.nada.kth.se/~viggo/wwwcompendium/node160.html >. This probably doesn't really help you. Something that comes close to helping can be found here: < http://mathworld.wolfram.com/Bin-PackingProblem.html >. "An alternative strategy first orders the items from largest to smallest, then places them sequentially in the first bin in which they fit. In 1973, D. Johnson showed that this strategy is never suboptimal by more than 22%, and furthermore that no efficient bin-packing algorithm can be guaranteed to do better than 22% (Hoffman 1998, p. 172)." This comes close to specifying a shell script that someone could write. In fact, Chris F.A. Johnson wrote one, it can be found in his book _Shell Scripting Recipes_, ISBN 1-59059-471-1. Section 13.2 bin-pack -- Fill Fixed-Capacity Directories with Files. Scripts from the book are available for download at < http://www.apress.com >. >From the mathematical theory to the web-site download in only a few minutes. :-) carl -- carl lowenstein marine physical lab u.c. san diego [EMAIL PROTECTED] -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-newbie
