This thread might be useful, but it's about flattening everything into the current directory, rather than flattening each sub-directory separately.
Do you care what the filenames are after the flattening? If not then there's a pretty easy way to do it. Otherwise, it's probably still possible but might take some thought.