View previous topic :: View next topic |
Author |
Message |
JoHo42 l33t
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 |
|
|
hitachi Guru
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 |
|
Back to top |
|
|
Necoro Veteran
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 |
|
|
Qubit Tux's lil' helper
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 |
|
|
Necoro Veteran
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 _________________ Inter Deum Et Diabolum Semper Musica Est. |
|
Back to top |
|
|
JoHo42 l33t
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 |
|
|
slick Bodhisattva
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 {} \; |
|
|
Back to top |
|
|
Qubit Tux's lil' helper
Joined: 23 Sep 2002 Posts: 136 Location: /dev/urandom
|
|
Back to top |
|
|
|