Re: ls mit vollständigem Pfad? (speziell für Skript-Künstler!) (fwd)
Hallo nochmal hab vergessen reinzuschreiben nach was er suchen soll :-) "find / -name *.mp3 2> /dev/null | tee mp3files" Hermann Kaiser Tel.: (07034) 930053 email: HermannKaiser@swol.de ---------- Forwarded message ---------- Date: Fri, 8 Jan 1999 12:19:30 +0100 (CET) From: Hermann Kaiser <HermannKaiser@swol.de> To: Raphael Becker <beckerra@rumms.uni-mannheim.de> Cc: suse-linux@suse.com Subject: Re: ls mit vollständigem Pfad? (speziell für Skript-Künstler!) Hallo Raphael, versuchs mit "find / -name 2> /dev/null | tee mp3files" Das mit root - Rechten ausgeführt bekommst Du die gewünschte Liste ;-) ciao Hermann Hermann Kaiser Tel.: (07034) 930053 email: HermannKaiser@swol.de On Fri, 8 Jan 1999, Raphael Becker wrote:
Hallo *
Ich habe mal eine kleine Knobelaufgabe für Skript-Künstler:
Ich möchte eine Liste aller auf meinem System befindlichen mp3-Files machen und diese in eine Datei umleiten. Der x11amp braucht kein spezielles Format, lediglich eine Liste von Dateinamen (incl Pfad!).
Ich habe mir die man-Page von ls mal genau angeschaut und nichts entsprechendes finden können.
Halbwegs praktikabel ist
ls -1 -R
was mir eine Liste im Format
Verz/: Datei1 Datei2 Datei3
erzeugt, falls sich ausgehend vom aktuellen Verzeichnis die Dateien im Verzeichnis Verz/ befinden.
Ich benötige eine Ausgabe der Form
aktuelles_Verzeichnis/Verz/Datei1 aktuelles_Verzeichnis/Verz/Datei2 aktuelles_Verzeichnis/Verz/Datei3
Einen Nachteil hat die Sache noch: ls -1 -R *.mp3 zeigt mir zwar im aktuellen Verzeichnis nur die *.mp3-Dateien, es wird aber nicht mehr in Unterverzeichnissen weitergesucht, daher werde ich das ganze wohl greppen müssen.
Außerdem möchte ich nicht die Pfadnamen ausgehend vom aktuellen Verzeichnis haben sondern egal von wo aus ich starte den kompletten (absoluten) Pfad zur Datei.
Welches (kleine) und einfach Skript könnte das schaffen?
Gibt es gar ein fertiges Programm, was mir sowas liefert? Wenn ja, welche Parameter?
Danke schonmal für Eure Hilfe
Raphael Becker -- ___________ Powered by SuSE __________________ ___ /___(_)__________ _____ __ ___ ____/__|__ / Raphael __ / __ /__ __ \ / / /_ |/_/ ______ \ ___/_ < Becker _ /___ / _ / / / /_/ /__> < ____/ /______/ / /_____/_/ /_/ /_/\__,_/ /_/|_| /_____/_(_)____/ -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
-- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
On Fri, 8 Jan 1999, Hermann Kaiser wrote:
"find / -name *.mp3 2> /dev/null | tee mp3files"
Wenn Du Glueck hast, liegt im aktuellen Verzeichnis gerade ein .mp3 File rum und Du findest nur dieses. Wenn Du Pech hast, liegen da mehrere und find beschwert sich ueber die Optionen. Man sollte sich selbst solange trainieren, bis bei Verwendung von Wildcards das Fluchten mit dem Rueckenmark stattfindet. Reflexe sind immer gut :) Was MIR aber ueberhaupt nicht passt, ist das Vollquoting, das Du hier oefters zelebrierst. Was hilft die Signature anderer Leute zur Problemloesung ? Weil wir gerade ueber Benehmen diskutieren, wuensche ich mir manchmal dringend FUER DEN LESER freundlich gestaltete Postings mit deutlichem Subject (ich liefere hier gerade ein Beispiel fuer Missbrauch, erwarte aber auch keinen Thread aus dieser Post), sinnigem Quoting und Empfaengerlisten unter drei Eintraegen. Freundliche Worte alleine haben noch nichts mit Hoeflichkeit zu tun. Gerhard Sittig -- If you don't understand or are scared by any of the above ask your parents or an adult to help you. -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
On Fri, 8 Jan 1999, Gerhard Sittig wrote:
On Fri, 8 Jan 1999, Hermann Kaiser wrote:
"find / -name *.mp3 2> /dev/null | tee mp3files"
Wenn Du Glueck hast, liegt im aktuellen Verzeichnis gerade ein .mp3 File rum und Du findest nur dieses. Wenn Du Pech hast, liegen da mehrere und find beschwert sich ueber die Optionen.
Hallo Gerhard, wo Du recht hast, hast Du recht! Ich habs gerade mal ausprobiert, funktioniert so nicht! Ich habs allerdings unter einer SuSE 5.3 vorher versucht und es hat geklappt! Tut es auch immer noch? Gerade noch mal weiter getestet, auf einem Rechner klappt es auf dem anderen nicht ( beide SuSE 5.3 )??? Woran liegt das? aber so sollte es doch dann auf jeden Fall klappen: find / -name "*.mp3" 2> /dev/null ciao Hermann PS: Wegen quoting von Signatures verspreche ich Besserung ;-) -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
Am Sam, 09 Jan 1999 schrieb Hermann Kaiser:
Hallo Gerhard,
Ich bin zwar nicht Gerhard, aber ich antworte mal.
wo Du recht hast, hast Du recht! Ich habs gerade mal ausprobiert, funktioniert so nicht! Ich habs allerdings unter einer SuSE 5.3 vorher versucht und es hat geklappt! Tut es auch immer noch? Gerade noch mal weiter getestet, auf einem Rechner klappt es auf dem anderen nicht ( beide SuSE 5.3 )??? Woran liegt das?
aber so sollte es doch dann auf jeden Fall klappen: find / -name "*.mp3" 2> /dev/null
Hallo Hermann, Du möchstest den Shell-Ersetzungmechanismus verstehen lernen. Die Shell ersetzt *name* durch alle Dateinamen des aktuellen Verzeichnisses in denen die Buchstabenkombination name vorkommt. Wenn Du ein file namens test.mp3 in Deinem Verzeichnis hast, so ersetzt die Shell *.mp3 durch test.mp3 und ruft dann den Befehl find / -name test.mp3 auf, und lenkt die Fehlermeldungen um. Befinden sich in Deinem Verzeichnis aber die beiden Dateien t.mp3 und test.mp3, so ersetzt die Shell obige Komandozeile durch find / -name t.mp3 test.mp3 was zu einer Fehlermeldung führt. Wenn Du das Argument quotest, so nimmt die Shell nur die Quoten weg, und übergibt die Argumente so wie sie sind dem Programm, das daraus nun was machen kann/muß. Um es noch einmal klar zu sagen, das Programm merkt nichts von dem Ersetzungsmechanismus. Das Unterschiedliche Verhalten bei Dir ist wahrscheinlich darauf zurückzuführen, daß Du in ander Verzeichisse warst. Bitte schau Dir die unterschiedlichen Bedeutung von \ und ",' sowie ` an. Wobei letzteres kein quoten ist. cu Bernd -- Bernd Brodeßer Mönchengladbach B.Brodesser@online-club.de -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
On Sat, 9 Jan 1999, Hermann Kaiser wrote:
On Fri, 8 Jan 1999, Gerhard Sittig wrote:
On Fri, 8 Jan 1999, Hermann Kaiser wrote:
"find / -name *.mp3 2> /dev/null | tee mp3files"
Wenn Du Glueck hast, liegt im aktuellen Verzeichnis gerade ein .mp3 File rum und Du findest nur dieses. Wenn Du Pech hast, liegen da mehrere und find beschwert sich ueber die Optionen.
wo Du recht hast, hast Du recht! Ich habs gerade mal ausprobiert, funktioniert so nicht! Ich habs allerdings unter einer SuSE 5.3 vorher versucht und es hat geklappt! Tut es auch immer noch? Gerade noch mal weiter getestet, auf einem Rechner klappt es auf dem anderen nicht ( beide SuSE 5.3 )??? Woran liegt das?
Hauptsaechlich liegt das an der Anzahl Dateien, die im aktuellen Verzeichnis rumliegen und uf die Wildcards passen. "echo" ist Dein Freund in diesen Faellen (BTW auch bei ' (tick) und ` (backtick)). Probier ein echo find / -name *.mp3 mit keiner, einer und mehreren Files, die passen. Das ist ein Feature der Shell und kann zur Not im Manual nachgelesen werden :>
PS: Wegen quoting von Signatures verspreche ich Besserung ;-)
Das wuensche ich mir von ALLEN Teilnehmern -- freue mich aber ueber jeden einzelnen, der BEWUSST schreibt. :) Gerhard Sittig -- If you don't understand or are scared by any of the above ask your parents or an adult to help you. -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
Hermann Kaiser wrote:
Hallo nochmal hab vergessen reinzuschreiben nach was er suchen soll :-)
"find / -name *.mp3 2> /dev/null | tee mp3files"
Hi, super Quoting! Fuer 10 Zeilen eigenen Text, den ganze thread mit drange- haengt, danke. bernd -- Um aus der Liste ausgetragen zu werden, eine Mail an majordomo@suse.com schicken, mit dem Text: unsubscribe suse-linux
participants (4)
-
B.Brodesser@online-club.de
-
G.Sittig@abo.FreiePresse.DE
-
HermannKaiser@swol.de
-
Illuminatus@t-online.de