Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I want to write a script that will copy a source directory tree into a new directory tree structure that will be ready to be burned to DVD. Something like DVD1, DVD2, DVD3, where each directory is limited to 4GB. A program like burned to the brim would be perfect except it windows based and I need something that is platform independent. I looked at the cpan modules and File::Copy::Recursive seemed like a good starting point but it doesn't support limits by directory size. Before writing something new I was wondering if anyone knew of something available or a better starting module.

Thank you in advance!

Replies are listed 'Best First'.
Re: Copy spanning multiple DVDs
by marto (Cardinal) on May 02, 2006 at 19:18 UTC
      Martin,thanks for the pointers to other nodes. I had done a super search but I used other keywords (copying, spanning). I hadn't heard of the knapsack problem. This is a great starting point. It actually nearly solves the complete problem.

      I love perlmonks, there's always something new to learn.

Re: Copy spanning multiple DVDs
by revdiablo (Prior) on May 02, 2006 at 19:42 UTC

    In addition to marto's excellent pointers, you might want to have a look at my module, Algorithm::BinPack. I wrote the module with exactly this kind of problem in mind. You'll still have to do a bit of work, but the hard part (filling the DVDs as much as possible) is done for you.