I have been digging through questions but can't seem to find the exact answer I need.
I have a directory with multiple subdirectories:
sent sent.~16~ sent.~22~ sent.~29~ sent.~35~ sent.~41~ sent.~48~ sent.~54~ sent.~60~ sent.~67~ sent.~73~ sent.~8~
sent.~10~ sent.~17~ sent.~23~ sent.~3~ sent.~36~ sent.~42~ sent.~49~ sent.~55~ sent.~61~ sent.~68~ sent.~74~ sent.~80~
sent.~11~ sent.~18~ sent.~24~ sent.~30~ sent.~37~ sent.~43~ sent.~5~ sent.~56~ sent.~62~ sent.~69~ sent.~75~ sent.~81~
sent.~12~ sent.~19~ sent.~25~ sent.~31~ sent.~38~ sent.~44~
Where each subdirectory holds a bunch of numbered files:
1. 11. 13. 15. 17. 4. 6. 8.
10. 12. 14. 16. 3. 5. 7. 9.
Essentially I would like to merge all these subdirectories into one directory, but not overwrite files with the same name. Will I need to change the name of files in each subdirectory to do this (ex: foo --> foo_~10~)
, and then merge all files to one subdirectory?
Is there an easy bash or shell script I can use for this? I have tried some variations of rsync, mv, and cp, but haven't quite gotten what I would like.