find ./from -type f | awk ‘{ str=$0; sub(/\.\//, “”, str); gsub(/\//, “-”, str); print “mv ” $0 ” ./to/” str }’ | bash
Flatten it, without collisions
Reply
find ./from -type f | awk ‘{ str=$0; sub(/\.\//, “”, str); gsub(/\//, “-”, str); print “mv ” $0 ” ./to/” str }’ | bash