Thursday, July 7, 2011

Find recursively and copy files in Unix

I was trying to do a recursive search in Unix using find command and then copy all those files to a specific folder.

I found below command does that.

find . -name *2011-03-19* -exec cp {} /home/Reddy/logs/ \;

Important thing is, we need to escape the ending semi-colon.

{} is the place holder for putting the search result, i.e., the file name found.

Latest Posts