find and copy file using Bash

bash, copy, find, linux

Solution

I would recommend using `find`'s `-exec` option:

`find . -ctime 15 -exec cp {} ../otherfolder \;`

As always, consult the manpage for best results.

Problem

Anybody has an alternate way of finding and copying files in bash than: ``` find . -ctime -15 | awk '{print "cp " $1 " ../otherfolder/"}' | sh ``` I like this way because it's flexible, as I'm building my command (can by any command) and executing it after. Are there other ways of streamlining commands to a list of files? Thanks

Original source

Related problems