How do I copy folders with a file in them that has a grep pattern and preserve the folder structure
Basically I want to grep for the word "KDE" in /usr/ports/core and if a file in a subfolder matches I want to copy the folder with the files in it to another folder.
the command: grep -inrl "kde" /usr/ports/core | xargs cp -rv -p /Voncloft-OS/KDE
is almost working but not quite it moves the files to /Voncloft-OS/KDE
....but not the folder structure.
Thanks.
|