I have a directory structure that looks like this:
foo
├── 1.txt
├── 2.txt
├── 3.txt
├── 4.txt
└── bar
├── 1.txt
├── 2.txt
└── 5.txt
I would like to flatten this directory structure so that all files are in the foo directory and duplicate files are preserved:
foo
├── 1.txt
├── 2.txt
├── 3.txt
├── 4.txt
├── bar-1.txt
├── bar-2.txt
└── bar-5.txt
The file names of the renamed duplicates is insignificant.
Is there a simple Unix one-liner or simple shell script I can use to do this?