Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
rm in Unterverzeichnissen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
JoHo42
l33t
l33t


Joined: 14 Feb 2004
Posts: 956
Location: Germany

PostPosted: Tue Apr 07, 2009 9:46 am    Post subject: rm in Unterverzeichnissen Reply with quote

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
View user's profile Send private message
hitachi
Guru
Guru


Joined: 20 Feb 2006
Posts: 478
Location: Freiburg / Deutschland

PostPosted: Tue Apr 07, 2009 9:50 am    Post subject: Reply with quote

Versuch mal was wie:
Code:
rm -vi */supertop

Bitte versuch es zuerst mal nicht im root Verzeichnis ;-)
Back to top
View user's profile Send private message
Necoro
Veteran
Veteran


Joined: 18 Dec 2005
Posts: 1912
Location: Germany

PostPosted: Tue Apr 07, 2009 10:03 am    Post subject: Reply with quote

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
View user's profile Send private message
Qubit
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2002
Posts: 136
Location: /dev/urandom

PostPosted: Tue Apr 07, 2009 10:13 am    Post subject: Reply with quote

Necoro wrote:
Code:
find -name supertopfile -type f -print0 | xargs -0 rm



find / -name supertopfile -type f -print0 | xargs -0 rm :D

oder bash-4.0 mit globstar ...

Gruß Daniel
_________________
©Qubit
Back to top
View user's profile Send private message
Necoro
Veteran
Veteran


Joined: 18 Dec 2005
Posts: 1912
Location: Germany

PostPosted: Tue Apr 07, 2009 10:22 am    Post subject: Reply with quote

Qubit wrote:
oder bash-4.0 mit globstar ...

Oder zsh mit dem gleichen Feature ;)
_________________
Inter Deum Et Diabolum Semper Musica Est.
Back to top
View user's profile Send private message
JoHo42
l33t
l33t


Joined: 14 Feb 2004
Posts: 956
Location: Germany

PostPosted: Tue Apr 07, 2009 11:25 am    Post subject: Reply with quote

Hi,

Die erste Antwort hat seinen Zweck erfuellt.
Das hat gut funktioniert.

Gruss Joerg
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Tue Apr 07, 2009 1:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Qubit
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2002
Posts: 136
Location: /dev/urandom

PostPosted: Tue Apr 07, 2009 3:21 pm    Post subject: Reply with quote

slick wrote:
Necoro wrote:
Code:
find -name supertopfile -type f -print0 | xargs -0 rm

Schöner:

Code:
find -name supertopfile -type f -exec rm {} \;

;)


Allerdings bei großen Datenmengen nicht so performant wie xargs:

z.B:

http://linuxseiten.kg-it.de/index.php?index=bash_Der_Befehl_xargs
http://www.sunmanagers.org/pipermail/summaries/2005-March/006255.html

ebenfall interessant:

https://www.adminlife.net/tips/argument-list-too-long/

Gruß Daniel
_________________
©Qubit
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum