find and copy file using Bash [duplicate] find and copy file using Bash [duplicate] linux linux

find and copy file using Bash [duplicate]


I would recommend using find's -exec option:

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

As always, consult the manpage for best results.


I usually use this one:

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


You can do it with xargs:

$ find . -ctime 15 -print0 | xargs -0 -I{} cp {} ../otherfolder

See also grep utility in shell script.