I found this solution after googling here but I was horrified: too complicated solution. I am pretty sure some cp -versions have flags for this or just simple find will do. So how do you copy files, not directory structure, in Unix?
find path-to-source-file-tree -type f -exec cp {} path-to-target-dir \;
That should take care of all your issues.
To customize it further you can refer: man find For example, based on date and time, file types, file owners, etc. you can customize the above statement.
I would use find, cannot find a flag in my GNU Coreutils 8.5 cp about not-preserving directory-structure. Anyway the one-liner:
find . -type f -exec cp '{}' ~/Backup/ \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With