Re: Using "find" in a script..

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

 



Hi,

> The command that should do its is..
> 
> find /backups/fcws/ -mtime +15 -maxdepth 1 -type d -exec rm -rf {};
> 
> The problem is that because there are currently no directories to delete 
> I get the error..
> 
> find: missing argument to `-exec'
> 
> Anyone got any ideas? to avoid this?
> 
> 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..

cd /backups/fcws
find . -mtime +15 -maxdepth 1 -type d -exec rm -rf {} \;


does the trick even if there are no directories right now.


Cheers,


Torsten
-- 
******************************************************
* Spam isn't speech, just like a note wrapped around *
* a brick thrown through a window isn't publication. *
******************************************************
    __  __      __       http://www.fireball.de
   / / / /     /_/       Torsten Eberhardt
  / / / /___  ____  __   Lycos Europe GmbH
 / /_/ / __ \/ /\ \/ /   20444 Hamburg
/_____/_/ /_/_/ /_/\_\   +49(0)40 3703-7720 FAX -7757

Attachment: signature.asc
Description: This is a digitally signed message part


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

  Powered by Linux