Re: Using "find" in a script..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Di, den 20.04.2004 schrieb WipeOut um 16:51:

> The command that should do its is..
> 
> find /backups/fcws/ -mtime +15 -maxdepth 1 -type d -exec rm -rf {};

> find: missing argument to `-exec'
> 
> Anyone got any ideas? to avoid this?

Others already gave the answer (escaping the ;).

Besides that you better avoid other circumstances (failures like "too
much arguments") by using xargs instead of -exec. So the line from above
would look like

find /backups/fcws/ -mtime +15 -maxdepth 1 \
-type d -print0 | xargs -0 rm -rf

> Otherwise I am going to have to create an "if" routine to test first if 
> there are any to delete and if there are then run the command otherwise 
> skip it..
> 
> Later..

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 1 (Yarrow) on Athlon CPU kernel 2.4.22-1.2179.nptl
Sirendipity 17:06:53 up 1 day, 23:52, load average: 1.34, 1.28, 1.22 
                   [ ÎÎÏÎÎ Ï'ÎÏÏÎÎ - gnothi seauton ]
             my life is a planetarium - and you are the stars



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux