I'm trying to copy all .h files in a directory and all subdirectories into another folder using the copy command:
cp --parents -r tensorflow/lite/**/*.h libtensorflowlite-2.13.0-linux/include
The above glob only copies .h files in tensorflow/lite/XXX/*.h
and doesn't include .h files further down (eg. tensorflow/lite/XXX/XXX.h
) or in the root (tensorflow/lite/*.h
). To workaround this, I have to issue several cp
commands for all expected levels of recursion:
cp --parents -r tensorflow/lite/*.h libtensorflowlite-2.13.0-linux/include
cp --parents -r tensorflow/lite/**/*.h libtensorflowlite-2.13.0-linux/include
cp --parents -r tensorflow/lite/**/**/*.h libtensorflowlite-2.13.0-linux/include
cp --parents -r tensorflow/lite/**/**/**/*.h libtensorflowlite-2.13.0-linux/include
I know I'm missing something obvious here. Is there an easier way to create a glob that says "all files ending in .h in all subdirectories recursively"?
globstar
option set in your shell? – DonHolgo Jul 20 '23 at 17:01