|Welcome to the Monastery|
How to maximise the content of my data CDby amaguk (Sexton)
|on Feb 25, 2005 at 11:58 UTC||Need Help??|
amaguk has asked for the
wisdom of the Perl Monks concerning the following question:
I've some questions about a practical problem. I've a directory with a lot of files. I want to burn some CD with these files, but how can I maximise the content of each CD, and minimize the total number of CD ?
Is there an existing script (nothing found during my search, but...).
Is there a good algorithm ?My first thinking are :
- number of CD = round up (total size in Mo / 700Mo)
- in CD1, I put the largest file if total size of CD1 is < 700Mo or on the following CD;
- in CD2, I put the second largest file if total size of CD2 is < 700Mo or on the following CD;
- in CD3, I put the third largest file if total size of CD3 is < 700Mo or on the following CD;
- in CDn, I put the nth largest file if total size of CDn is < 700Mo or on the following CD;
- and I loop on the first CD !
- If there is always files and all my n CD are full, I create a new CD where I put these files.
Is there a better algoritm (I guess yes ;)) ?
Thanks in advance