View previous topic :: View next topic |
Author |
Message |
Der_Biber n00b
Joined: 14 Jan 2003 Posts: 26
|
Posted: Tue Oct 04, 2005 12:42 pm Post subject: Tool um Dateien zu löschen die älter sind als ....[solved] |
|
|
Hi
ich suche ein Kommandozeilen-Tool, das mir alle Dateien (in einem Ordner) löscht die älter sind als ein bestimmtes Datum....
Da gibt es doch bestimmt was
Danke
Last edited by Der_Biber on Sat Oct 08, 2005 6:38 pm; edited 1 time in total |
|
Back to top |
|
|
chrib Guru
Joined: 27 Sep 2003 Posts: 558 Location: Berlin, Germany
|
Posted: Tue Oct 04, 2005 1:01 pm Post subject: |
|
|
ungetestet, also vorher mal in nem Testverzeichnis ausführen.
Code: | touch -t YYMMDDhhmm wegmitdemaltenmuell |
und
Code: | find . ! -newer wegmitdemaltenmuell -exec rm {} \; |
Ansonsten, man touch, man find _________________ Der Mensch kämpft um zu überleben, und nicht, um zu Grunde zu gehen. - Paulo Coelho
It is the end of all hope. To lose the child, the faith. To end all the innocence. To be someone like me. - Nightwish - End of all hope |
|
Back to top |
|
|
ckoebke n00b
Joined: 22 Aug 2005 Posts: 4
|
Posted: Tue Oct 04, 2005 1:10 pm Post subject: |
|
|
man find
bei suche nach create time (datum der erstellung des files)
find <ordner> -ctime +7 -exec rm{} \; # File status was changed 7*24h ago
find <ordner> -mtime +7 -exec rm{} \; # File data was last modified 7*24h ago
find <ordner> -atime +7 -exec rm{} \; # File was last accessed 7*24h ago
je nachdem was du von den Beispielen brauchst werden Dateien im <ordner> (und darunter) älter 7 tage gelöscht. |
|
Back to top |
|
|
tam Guru
Joined: 04 Mar 2003 Posts: 569
|
|
Back to top |
|
|
ChrisM87 l33t
Joined: 07 Aug 2004 Posts: 728 Location: Rheinland-Pfalz (Germany)
|
Posted: Tue Oct 04, 2005 8:34 pm Post subject: |
|
|
Hi,
auch das gleiche:
emerge tmpreaper
Chris _________________ born to be root - sorry for my bad English! |
|
Back to top |
|
|
Der_Biber n00b
Joined: 14 Jan 2003 Posts: 26
|
Posted: Wed Oct 05, 2005 12:34 pm Post subject: |
|
|
Danke!
tmpwatch... genau das hab ich gesucht! |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3925 Location: Hamburg
|
Posted: Wed Oct 05, 2005 3:20 pm Post subject: |
|
|
ckoebke wrote: | man find
find <ordner> -ctime +7 -exec rm{} \; |
Da fehlt noch ein Leerzeichen zwischen rm und {}, außerdem sollte {} als '{}' geschrieben werden, nur für den Fall, daß ja jemand Leer- oder Sonderzeichen in dem Dateiname verwendet hat. |
|
Back to top |
|
|
|