Am Montag, 9. Februar 2004 12:05 schrieb Dr. Jürgen Vollmer:
Matthias Dort schrieb:
hier ist meine Kommando-Zeile: find dir1 dir2 dir3 -name "*.c" -mtime +7 | tar cvf /tmp/c.tar - Sie funktioniert aber nicht. Wo kann der Fehler sein? [...] besser wäre z.B.
find dir1 dir2 dir3 -name "*.c" -mtime +7 > /tmp/files.txt tar -cvf /tmp/c.tar -T /tmp/files.txt
-T, --files-from=F get names to extract or create from file F
aber warum so kompliziert? tar kennt doch auch: und mit "date" kann man auch rechnen: date -d "-7 days"
tar -cvf /tmp/c.tar --newer-mtime=`date -d "-7 days" +"%Y/%m/%d"` dir1 dir2
Warum so kompliziert - mit den tar-Optionen kriegst Du nie die gesamte Funktionalität vom find abgedeckt. Du kannst der Option -T aber ohne Probleme ein - nachstellen: find dir1 dir2 dir3 -name "*.c" -mtime +7 | \ tar -cvf /tmp/c.tar -T - Der Vollständigkeit halber noch die Ur-Unix-Version mit dem unbekannten Wesen cpio: find dir1 dir2 dir3 -name "*.c" -mtime +7 | cpio -ocBv >/tmp/c.cpio Jan