find and copy file using Bash

Viewed 95237

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

6 Answers

Use this for copy and many other things:

for f in $(find /apps -type f -name 'foo'); do cp ${f} ${f}.bak; cmd2; cmd3; done;
Related