LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find -exec help (https://www.linuxquestions.org/questions/linux-newbie-8/find-exec-help-491417/)

dc144 10-11-2006 08:40 AM

find -exec help
 
Hi All,

I am trying to use the find command to find files not modified for more than 5 minutes and move the file(s) to another dir. But the error is missing argument to '-exec'


find . -mmin +5 -type f -exec mv {} mydir \;
find: missing argument to `-exec'


What did I miss out? Please help.
Thanks

michux 10-11-2006 09:55 AM

Quote:

Originally Posted by dc144
Hi All,

I am trying to use the find command to find files not modified for more than 5 minutes and move the file(s) to another dir. But the error is missing argument to '-exec'


find . -mmin +5 -type f -exec mv {} mydir \;
find: missing argument to `-exec'


What did I miss out? Please help.
Thanks

I tried the same command on my box and it.. worked :)
At least it did not produce an error message.

Perhaps try something like:
Code:

find . -mmin +5 -type f -exec 'mv {} mydir' \;
and check ifthat helps...

berbae 10-11-2006 09:55 AM

I don't see exactly what the word 'mydir' stands for :
An environment variable, a real directory, or what ?

dc144 10-12-2006 02:14 AM

Thanks michux,
Now there's a new progress but still not working
with the single quote '', the message is

find: mv myfile mydir: no such file or directory


berbae, mydir is just a directory I created.


All times are GMT -5. The time now is 01:34 PM.