Re: leere verzeichnisse aus Shellskript löschen

From: Oliver Fromme <olli(at)lurza.secnetix.de>
Date: Mon, 14 Oct 2013 15:39:46 +0200 (CEST)

Marc Santhoff wrote:
> On Mo, 2013-10-14 at 04:16 +0000, Christian Weisgerber wrote:
> > Marc Santhoff <M.Santhoff(at)web.de> wrote:
> >
> > > ich möchte in einem Shellskript mit möglicht simplen Mitteln leere
> > > Verzeichnisse finden und löschen.
> > >
> > > find $DIR -type d -exec CNT=ls {} \;
> >
> > -type d -empty
>
> Urgs, das habe ich gesucht. Auf den Namen bin ich aber nicht gekommen,
> habe immer bei -size geguckt.
>
> rmdir wäre auch OK, aber ich muß ja erst auf "Leersein" testen, das geht
> hiermit besser.

Ja, und zum Glück hat BSD die "-delete"-Action von gnu-find
"geklaut". Anderenfalls wäre es erheblich aufwendiger.

Gruß
   Olli

-- 
Oliver Fromme,  secnetix GmbH & Co. KG,  Marktplatz 29, 85567 Grafing
Handelsregister:  Amtsgericht Muenchen, HRA 74606, Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsreg.: Amtsgericht München,
HRB 125758, Geschäftsführer:  Maik Bachmann,  Olaf Erb,  Ralf Gebhart
FreeBSD-Dienstleistungen/-Produkte + mehr: http://www.secnetix.de/bsd
"People still program in C.  People keep writing shell scripts.  *Most*
people don't realize the shortcomings of the tools they are using because
they a) don't reflect on their workflows and they are b) too lazy to check
out alternatives to realize there is help." -- Simon 'corecode' Schubert
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Mon 14 Oct 2013 - 15:39:58 CEST

search this site