finding and copying the files to another location

finding and copying the files to another location

am 08.04.2008 12:27:08 von ujjwal

Hi,
i am trying to copy all the header files from the different folders of
a package and copying them to one single location by find command but
i am unable to find and copy all the files. anybody please help me
out.
find . -name *.h gives the file names but how to copy all the files
to one location?
Thnx in advance
Ujjwal

Re: finding and copying the files to another location

am 08.04.2008 12:52:07 von PK

ujjwal wrote:

> find . -name *.h gives the file names but how to copy all the files
> to one location?

find . -type f -name '*.h' -exec cp '{}' /new/location \;

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.