[Tutor] Sorting of files based on filesize
kent37 at tds.net
Mon Apr 11 19:17:59 CEST 2005
This is a hard problem. It is a version of the "0-1 knapsack problem" - googling for that might give
you some ideas.
Klas Marteleur wrote:
> Some of my harddrives are getting full and i would like to burn the files to
> some cheep DVD's. Filesizes range from lets say 1Mb to 1Gb.
> Ofcourse i would like to optimize the size of each DVD to be as close to 4.7Gb
> as possible (to save this cheep media :) ).
> There are plenty of software that are able to index my DVD's so sorting
> between disks is not a problem. Just size.
> What i would like to do is write a Python program that could sort my files
> (based on size) into chunks as close to a given storage size (DVD 4.7Gb, CD
> 650Mb...), and minimize the use of disks. Does anyone know of if something
> like this is done before in Python, that i could look at?
> With a couple of hundred files it should be a lot of possible combinations. So
> I am not lookng for something absolute, just something that could help me get
> a little closer to the truth :)
> Its the "sorting function" that i am looking for, getting filesizes and do the
> actual sorting of files on disk i will worry about later.
> Kind regards
> Tutor maillist - Tutor at python.org
More information about the Tutor