BladeSystem Forums have moved here
To make BladeSystem information easier to find, we have moved the BladeSystem forums here, to Servers and Operating Systems.
System Administration
Showing results for 
Search instead for 
Do you mean 

'-exec cmd' in find command

SOLVED
Go to Solution
Super Advisor

'-exec cmd' in find command

Dear all,

Does anyone know how to specify 2 parameters with the '-exec cmd' in find. e.g, I need to copy all files for the last week to another directoy, but it looks to me the cmd with -exec only takes one parameters(like rm), so how can I do that with one line, instead of a script:
find . -type f -mtime -7 -exec ??? {} \;
3 REPLIES
Trusted Contributor

Re: '-exec cmd' in find command

Hi,

try

find . -type f -mtime -7 -exec cp {} /dir \;

br Jan
GSM, Intelligent Networks, UNIX
Honored Contributor

Re: '-exec cmd' in find command


Collected files on using find commands are given as {} to -exec option.

find . -type f -mtine -7 -exec cp {} /destination-dir/ \;

You can use multiple -exec there as,

find . -type f -mtine -7 -exec ll {} \; -exec cp {} /destination-dir/ \;
Easy to suggest when don't know about the problem!
Super Advisor

Re: '-exec cmd' in find command

thank you guys, it works fine!