LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find: missing argument to `-exec' (https://www.linuxquestions.org/questions/linux-newbie-8/find-missing-argument-to-%60-exec-308111/)

pavodive 03-31-2005 02:31 AM

find: missing argument to `-exec'
 
this must be a very silly question, but after reading man find several times I haven't been able to figure out how to make it work...

I want to find the files in some folder that match some pattern and that were modified more than XX days ago, and delete them .

What I'm using is:
Code:

find ~/sync/papers/ -name p*.* -mtime +5 -ls -exec rm{};
but I always get the error
find: missing argument to '-exec'

I've tried several approaches -rm{} [rm{}] {rm{}} (rm{}) --rm{} but the error persists :(

What am I doing wrong???
Is there any other way I can find and delete those files??

Thanks for the help!

PavoDive
:newbie:

microkernel 03-31-2005 03:07 AM

There should be some space between rm and {}

#find ~/sync/papers/ -name p*.* -mtime +5 -exec rm {} \;

And dont put -ls. If you want to use ls, you must use it with -exec.

youngtom 03-31-2005 04:15 AM

note the backslash before the semi-colon as well in pavodive's example

pavodive 03-31-2005 10:02 PM

Thank you guys! helped a lot!

misiu_mp 10-05-2009 02:24 PM

At last I know how to do -exec with find!
These forums will be a source of google-based knowledge for generations to come!


All times are GMT -5. The time now is 01:10 AM.