To flatten a unix directory structure (indir) one can use find with -exec-parameter:

$ find indir -iname '*.jpg' -exec cp {} outdir/ \;

outdir should not be inside of indir to avoid recursion hell. If copying needs too much space generating hard links instead is a good idea:

$ find indir -iname '*.jpg' -exec ln '{}' outdir/ \;

This is especially useful when generating folders for photo slide shows.