Using the code in this answer, I can easily copy a file containing specific text from one folder to another. With the
-r option I can also search inside directories recursively.
The result is that now I have a lot of files copied in the destination directory. What if I want to preserve the directory hierarchy while copying the files?
FWIW, I'm on Ubuntu 14.04 x64