View previous topic :: View next topic |
Author |
Message |
JoHo42 l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/851234420408e4e4fcac30.jpg)
Joined: 14 Feb 2004 Posts: 956 Location: Germany
|
Posted: Tue Apr 07, 2009 9:46 am Post subject: rm in Unterverzeichnissen |
|
|
Hi Leute,
doofe frage, aber wie kann ich mit einem Kommando z.b. rm Dateien in Unterverzeichnisse loeschen?
Also ich stehe z.B. im / also im root Verzeichnis.
Jetzt moechte ich z.B. supertopfile loeschen. "rm supertopfile" so wuerde supertopfile geloescht werden,
aber ich moechte das das auch in /user /root /bin und allen anderen Verzeichnissen passiert.
Gruss Joerg |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
hitachi Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 20 Feb 2006 Posts: 478 Location: Freiburg / Deutschland
|
Posted: Tue Apr 07, 2009 9:50 am Post subject: |
|
|
Versuch mal was wie:
Bitte versuch es zuerst mal nicht im root Verzeichnis ![Wink ;-)](images/smiles/icon_wink.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Necoro Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/163672451943ab3dcad64df.gif)
Joined: 18 Dec 2005 Posts: 1912 Location: Germany
|
Posted: Tue Apr 07, 2009 10:03 am Post subject: |
|
|
Code: | find -name supertopfile -type f -print0 | xargs -0 rm |
Kannst den find aufruf auch noch so modifizieren, dass er weitere Bedingungen enthält ... man find ist dein Freund
Und ja - man kann sich das mit xargs auch sparen und es direkt in den find-Aufruf einbauen (mit -exec) - aber das ist immer so umständliches Escapen ... wollte net lange probieren _________________ Inter Deum Et Diabolum Semper Musica Est. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Qubit Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 23 Sep 2002 Posts: 136 Location: /dev/urandom
|
Posted: Tue Apr 07, 2009 10:13 am Post subject: |
|
|
Necoro wrote: | Code: | find -name supertopfile -type f -print0 | xargs -0 rm |
|
find / -name supertopfile -type f -print0 | xargs -0 rm
oder bash-4.0 mit globstar ...
Gruß Daniel _________________ ©Qubit |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Necoro Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/163672451943ab3dcad64df.gif)
Joined: 18 Dec 2005 Posts: 1912 Location: Germany
|
Posted: Tue Apr 07, 2009 10:22 am Post subject: |
|
|
Qubit wrote: | oder bash-4.0 mit globstar ... |
Oder zsh mit dem gleichen Feature ![Wink ;)](images/smiles/icon_wink.gif) _________________ Inter Deum Et Diabolum Semper Musica Est. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JoHo42 l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/851234420408e4e4fcac30.jpg)
Joined: 14 Feb 2004 Posts: 956 Location: Germany
|
Posted: Tue Apr 07, 2009 11:25 am Post subject: |
|
|
Hi,
Die erste Antwort hat seinen Zweck erfuellt.
Das hat gut funktioniert.
Gruss Joerg |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
slick Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/155298905545589d9986ab5.gif)
Joined: 20 Apr 2003 Posts: 3495
|
Posted: Tue Apr 07, 2009 1:13 pm Post subject: |
|
|
Necoro wrote: | Code: | find -name supertopfile -type f -print0 | xargs -0 rm |
|
Schöner:
Code: | find -name supertopfile -type f -exec rm {} \; |
![Wink ;)](images/smiles/icon_wink.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Qubit Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 23 Sep 2002 Posts: 136 Location: /dev/urandom
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|