I use mp3 player with 32mb internal memory and 32mb external memory. Everytime I have to copy files seperately into the internal memory and external memory. I want to copy maximum number of files or total files size closest to 32mb everytime I copy.

I wrote a program which scans all the files and subfolders of a selected forder, displays the folder size and name in a listbox with multi select yes. When you choose the items the total files size is displayed in the status bar. I can also select/unselect individual files in a folder.

My friend wants to use this program to select files to copy to a CD. He dont care which folder he has to copy as long as he is able to copy maximum folders.

I am looking at some sort of algorithm with goes through an unsorted array containing the folder sizes and gives the indexes of the folders which I need to select to copy maximum folders.

Thanks,
Sripathi.