You can take one of the variants of the program in Hitchhiker's guide to Haskell, perhaps after working through some part of that tutorial; the tutorial is written around solving exactly yours problem of distributing things onto several disks whereby the solution is incrementally refined, as exemplified by the following passage from Chapter 3 of the tutorial:
Enough preliminaries already. let's go
pack some CDs.
As you might already have recognized,
our problem is a classical one. It is
called a "knapsack problem"
(google it up, if you don't know
already what it is. There are more
than 100000 links).
let's start from the greedy solution...
More ideas: a related question
Here is a similar question (although not the same: it's not being asked for optimization there), where you may find more useful solutions/programs for your task (if they will be posted):
Some hints for understanding the programming in the suggested tutorial
In general, the Haskell code is quite expressive (since Haskell is a language for programming on a high level of abstraction), and hence can be easily grasped.
When looking at the code of one of the solutions, remember that the top-level structure of the program we want to write is quite simple, as put in Chapter 1 of the tutorial:
Now let's think for a moment about how
our program will operate and express
it in pseudocode:
main = Read list of directories and their sizes.
Decide how to fit them on CD-Rs.
Print solution.
Sounds reasonable? I thought so.
Let's simplify our life a little and
assume for now that we will compute
directory sizes somewhere outside our
program (for example, with "du -sb *")
and read this information from stdin.
and look further more closely at the parts of the solution.