Okay, so I have a directory that has lots of files in it. These files are highly-compressed archives of documents, and I want to store these to a set of DVDs. That is, I want to have each archive on a disk, or many disks if its size requires.

The thing is, some of the archives are small, and some are very large (3-4 DVDs). So, I can't reasonably put each archive on its own disc. An obvious solution to this problem is to lrzip -o archive.lrzip ./* and then split -b 4700M archive.lrzip, but this means that whenever I want any files (or any of the archives), I have to retrieve EVERY disk, copy over the whole collection, etc.

I obviously can use split and manually determine the disc boundaries, e.g.: 1G archive, 3G archive, and split a 2G archive into parts to fill the disc, but that's slow.

I know this is a bit of a complicated problem description, but I think the problem is very easy to understand. Does anyone know of a way to sort of split these files along the medium boundaries (whether 4.7GB DVD, ~50GB Blu-ray, 500GB tape, etc)?

EDIT: Having been shown the bin-packing problem, this is a way to solve what I want to do, and considering the idea of a global directory, this could work, but I would prefer to keep the archives in alphabetical order, but it is not necessary.

  • 1
    I think you can modify some of the bin-packing programs in this question to handle files larger than the bin size. – Mark Plotnick May 15 '16 at 1:50
  • 1
    Before you start burning the discs, create subdirectories for each disc, and move the files there. Then, generate a complete file listing in text format you can include on each disc (the same, full listing, on each disc). That way, you can keep a local copy of that file to find where each file is. If you don't have that file, you can always just grab any of the discs to get the complete listing. I personally use find */ -type f -printf '%TY-%Tm-%Td %12s %p\n' to generate the listing of all files in all subdirectories, but you might wish to create a list of archive contents instead. – Nominal Animal May 15 '16 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.