Page 1 of 1

find files and copy them

Posted: Sat Apr 25, 2015 7:15 pm
by mister_v
hi

I would like to use the result of a find command into a copy command
find -iname *.xlsx
and then cp * to dir/


does anyone know how to do this?

Re: find files and copy them

Posted: Sat Apr 25, 2015 7:29 pm
by chris
The easiest way (and because it also copies files with spaces in the name) is:

Code: Select all

find -iname *.xlsx -exec cp '{}' dir/ \;
It is an option of find,
for more info check man find