I want to copy all binaries from /sourcedir and its sub-dirs to /destdir. Basically, all files with: no extension, and all files with *.a, *.so, *.ko, and exclude from copy: Makefile and *.depend. Exclude file copy from the sub-dir named "excludeDir". The command should place all binaries in a single folder.
I have tried the following from bash:
find /my/sourcedir/ -mindepth 2 -type f -not -iname "excludeDir" -or "*.c" -or "*.h" -or "makefile" -print -exec cp {} /my/destdir \;
bash script yields the following error:
find: paths must precede expression: `*.c'
The part that is giving me trouble are the exclusions (files: *.h, *.c, Makefile, and the sub-directory: "excludeDir" )
Using mjb2kmn's advice the following command does well except for globbing.
find /opt/ppmac-exp/ -mindepth 2 -not -iname *.c -not -iname *.cpp -not -iname *.cc -not -iname *.cs -not -iname *.h -not -iname *.cfg -not -iname *.sh -not -iname *.layout -not -iname *.depend -not -iname Makefile -not -iname Makefile* -type f -print -exec cp {} /opt/build \;