How can i copy only header files in an entire nested directory to another directory keeping the same hierarchy after copying to new folder
(cd src && find . -name '*.h' -print | tar --create --files-from -) | (cd dst && tar xvfp -)
You can do something similar with cpio if you just want to hard link the files instead of copying them, but it's likely to require a little mv'ing afterward. If you have lots of data and don't mind (or need!) sharing, this can be much faster. It gets confused if dst needs to have a src in it - this is, if it isn't just a side effect:
- find src -name '*.h' -print | cpio -pdlv dst
- mv dst/src/* dst/.
- rmdir dst/src