find and copy command

after i read about find and remove now i try to figure out about the other command that find can support of. actually find have an option called -exec that we can use for any command that linux have to control the find result. but i find difficulty when trying the copy command. i try and try but failed. after reading somewhere in find guide manual in the net, now i know what the {} function. it keeps the file name into the memory. so here what i type wrong before
#find /mydirectory -name “*.doc” -exec cp /otherdirectory {} ;

but this one is work and true
#find /mydirectory -name “*.doc” -exec cp {} /otherdirectory ;

and everything’s work.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.