Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

help me copy via "find"

SOLVED
Go to solution
Maaz
Valued Contributor

help me copy via "find"

I want to copy all the rpm under /rep directory to /test directory

# ls /rep
i586 noarch x86_64

# ls /rep/i586/
a.rpm b.rpm c.rpm


# find /rep -name "*rpm" -exec cp -rv - /test {}\;

find: missing argument to `-exec'


4 REPLIES
Dennis Handly
Acclaimed Contributor

Re: help me copy via "find"

> ... -exec cp -rv - /test {}\;

You need a space before the backslash. Also I would think you would need the {} first?
Uwe Zessin
Honored Contributor
Solution

Re: help me copy via "find"

# find /rep -name "*rpm" -exec cp -rv {} /test/ \;

But all files will end in /test - no subdirectories are being created.
.
Frank_W
Frequent Advisor

Re: help me copy via "find"


Hi,

you can also use:

cd /rep
find . -name "*rpm" -print | cpio -pdvm /test/
Maaz
Valued Contributor

Re: help me copy via "find"

excellent help
Dear Dennis Handly, yes I have to write "{}" before the destination (/test), as Uwe Zessin posted.

Nice help Dear Uwe Zessin, and Frank_W for the superb help ;)