This is from askubuntu.com
Using find + xargs + mv:
find . -type f -print0 | xargs -0 -I file mv --backup=numbered file .
This will move all the files in the current working directory and its subdirectories (recursively) into the current working directory, numbering files with the same filename numerically in order to avoid overwrites of files with the same filename.