Copy All Files with Specific String to Another Directory in Terminal on Mac - VicPhanDevOps/mac GitHub Wiki

• Type find . -type f -exec grep -lr ‘< string >’ {} \; -exec cp -r {] < destination directory > \; and press the return key to find specific string in all files in the source directory and copy them to the destination directory.
image

• Type ls < destination directory > and press the return key to sanity check that the files successfully copied over there.
image

⚠️ **GitHub.com Fallback** ⚠️