View previous topic :: View next topic |
Author |
Message |
loopx Advocate
Joined: 01 Apr 2005 Posts: 2787 Location: Belgium / Liège
|
Posted: Tue Dec 23, 2008 4:50 pm Post subject: [find] supprimer les fichiers de plus de 40 jours (résolu) |
|
|
Bonjour,
Je cherche une commande qui permet de supprimer les fichiers dont la date de modification est supérieur (ou égal ..) à 40 jours par exemple.
J'utilise ceci pour l'instant :
Code: |
cd mon_rep
find ./ -type f -mtime 40 -exec rm {} \;
|
Mais, après test, il apparait que un fichier de 2006 ne sera pas supprimer par cette commande!! Donc, est-ce que le find doit trouver un fichier de exactement 40 jours de modification ? (donc, si on rate l'exécution de la commande un jour, tout les fichiers qui aurait du être supprimé ne le seront plus jamais et ca, c'est inacceptable).
Donc, comment préciser à find que c'est pas un "=" mais un ">=" à 40 jours qu'il faut utiliser pour la sélection des fichiers ??? _________________ Mon MediaWiki perso : http://pix-mania.dyndns.org
Last edited by loopx on Tue Dec 23, 2008 10:09 pm; edited 1 time in total |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Tue Dec 23, 2008 5:54 pm Post subject: |
|
|
je peux pas tester d'ici mais ton truc m'intéresse donc je tente
Code: | find ./ -type f -not -mnewer 40 -exec rm {} \;
|
|
|
Back to top |
|
|
netfab Veteran
Joined: 03 Mar 2005 Posts: 1963 Location: 127.0.0.1
|
Posted: Tue Dec 23, 2008 6:12 pm Post subject: |
|
|
Quote: | find ./ -type f -mtime +40 -exec rm {} \; |
Quote: |
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
|
|
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Tue Dec 23, 2008 6:34 pm Post subject: |
|
|
Ah les boules! |
|
Back to top |
|
|
El_Goretto Moderator
Joined: 29 May 2004 Posts: 3174 Location: Paris
|
Posted: Tue Dec 23, 2008 7:29 pm Post subject: |
|
|
Code: | find ./ -type f -mtime +40 -delete |
C'est beau, c'est pur... snifff ... _________________ -TrueNAS & jails: µ-serv Gen8 E3-1260L, 16Go ECC + µ-serv N40L, 10Go ECC
-Réseau: APU2C4 (OpenWRT) + GS726Tv3 + 2x GS108Tv2 + Archer C5v1 (OpenWRT) |
|
Back to top |
|
|
dapsaille Advocate
Joined: 02 Aug 2004 Posts: 2366 Location: Paris
|
Posted: Tue Dec 23, 2008 8:08 pm Post subject: |
|
|
Nom di diou ..
Vous n'avez pas sorti les pancartes
ATTENTION COMMANDES DANGEREUSES
|
|
Back to top |
|
|
geekounet Bodhisattva
Joined: 11 Oct 2004 Posts: 3772
|
Posted: Tue Dec 23, 2008 10:02 pm Post subject: |
|
|
Sinon avec zsh :
|
|
Back to top |
|
|
loopx Advocate
Joined: 01 Apr 2005 Posts: 2787 Location: Belgium / Liège
|
Posted: Tue Dec 23, 2008 10:05 pm Post subject: |
|
|
netfab wrote: | Quote: | find ./ -type f -mtime +40 -exec rm {} \; |
Quote: |
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
|
|
Wahhh, merci
J'y était presque !
Puis, l'important c'est de participer merci _________________ Mon MediaWiki perso : http://pix-mania.dyndns.org |
|
Back to top |
|
|
loopx Advocate
Joined: 01 Apr 2005 Posts: 2787 Location: Belgium / Liège
|
Posted: Tue Dec 23, 2008 10:10 pm Post subject: |
|
|
geekounet wrote: | Sinon avec zsh :
|
zsh ??? _________________ Mon MediaWiki perso : http://pix-mania.dyndns.org |
|
Back to top |
|
|
Bapt Veteran
Joined: 14 Apr 2003 Posts: 1152 Location: Paris
|
Posted: Wed Dec 24, 2008 1:03 pm Post subject: |
|
|
geekounet wrote: | Sinon avec zsh :
|
et oui il y a ceux qui utilise des softs moderne fait pour faciliter la vie et ceux qui se font chier avec find |
|
Back to top |
|
|
truc Advocate
Joined: 25 Jul 2005 Posts: 3199
|
Posted: Wed Dec 24, 2008 5:06 pm Post subject: |
|
|
Bapt wrote: | et oui il y a ceux qui utilise des softs moderne fait pour faciliter la vie et ceux qui se font chier avec find |
Propagande! Propagande!
Bref, Si vraiment vous voulez triper, regarder plutôt le projet xfind => http://uucode.com/texts/xfind/
Au moins, là on ne repart pas d'une toute nouvelle syntaxe sortie de derrière les fagots... (ça ne veut pas dire que c'est moins clair, c'est juste la même histoire que pour les standards.. blah balh blah... _________________ The End of the Internet! |
|
Back to top |
|
|
loopx Advocate
Joined: 01 Apr 2005 Posts: 2787 Location: Belgium / Liège
|
Posted: Wed Dec 24, 2008 5:06 pm Post subject: |
|
|
Ouais, mais faut l'installer c'est pas de base :p _________________ Mon MediaWiki perso : http://pix-mania.dyndns.org |
|
Back to top |
|
|
Oupsman Veteran
Joined: 19 Jul 2004 Posts: 1042
|
Posted: Wed Dec 24, 2008 5:09 pm Post subject: |
|
|
loopx wrote: | Ouais, mais faut l'installer c'est pas de base :p |
Pis y'a d'autres OS que Linux ... Find se trouve partout et marche pareil partout. Zsh, à part Linux .... _________________ --
L'idéal de nouveauté semble avoir remplacé l'idéal de progrès. C'est bien triste.
----
Unix philosophy: "Do one thing and do it well."
systemd: "Try to do everything and do it wrong." |
|
Back to top |
|
|
truc Advocate
Joined: 25 Jul 2005 Posts: 3199
|
Posted: Wed Dec 24, 2008 5:53 pm Post subject: |
|
|
loopx wrote: | Ouais, mais faut l'installer c'est pas de base :p |
C'est pour ça que j'ai dit 'si vous voulez vraiment triper' _________________ The End of the Internet! |
|
Back to top |
|
|
geekounet Bodhisattva
Joined: 11 Oct 2004 Posts: 3772
|
Posted: Wed Dec 24, 2008 9:00 pm Post subject: |
|
|
Oupsman wrote: | loopx wrote: | Ouais, mais faut l'installer c'est pas de base :p |
Pis y'a d'autres OS que Linux ... Find se trouve partout et marche pareil partout. Zsh, à part Linux .... |
ZSH tourne sur tous les Unix |
|
Back to top |
|
|
Oupsman Veteran
Joined: 19 Jul 2004 Posts: 1042
|
Posted: Wed Dec 24, 2008 9:16 pm Post subject: |
|
|
geekounet wrote: | Oupsman wrote: | loopx wrote: | Ouais, mais faut l'installer c'est pas de base :p |
Pis y'a d'autres OS que Linux ... Find se trouve partout et marche pareil partout. Zsh, à part Linux .... |
ZSH tourne sur tous les Unix |
Voui mais il ne fait pas partie de l'installation de base ... Find, oui. Mais on a déjà eu ce débat _________________ --
L'idéal de nouveauté semble avoir remplacé l'idéal de progrès. C'est bien triste.
----
Unix philosophy: "Do one thing and do it well."
systemd: "Try to do everything and do it wrong." |
|
Back to top |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8723 Location: ~Brussels - Belgique
|
Posted: Fri Dec 26, 2008 12:43 pm Post subject: |
|
|
Bapt wrote: | geekounet wrote: | Sinon avec zsh :
|
et oui il y a ceux qui utilise des softs moderne fait pour faciliter la vie et ceux qui se font chier avec find |
Et qui te dit que zsh ne se base pas sur "find" pour effectuer cette mantra ? _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
ppg Apprentice
Joined: 05 Oct 2008 Posts: 178 Location: Toulouse
|
Posted: Fri Dec 26, 2008 5:09 pm Post subject: |
|
|
Bapt wrote: | geekounet wrote: | Sinon avec zsh :
|
et oui il y a ceux qui utilise des softs moderne fait pour faciliter la vie et ceux qui se font chier avec find |
Chacun son truc ; perso je trouve pas ça plus explicite que find. |
|
Back to top |
|
|
Enlight Advocate
Joined: 28 Oct 2004 Posts: 3519 Location: Alsace (France)
|
Posted: Sat Dec 27, 2008 3:46 am Post subject: |
|
|
geekounet wrote: | Sinon avec zsh :
|
Wow, c'est tellement moche que j'ai cru que c'était du ruby!
ben quoi le thread est déjà parti en troll, non? |
|
Back to top |
|
|
Shadow AOK n00b
Joined: 26 Jun 2006 Posts: 48 Location: Lyon, France
|
Posted: Sat Dec 27, 2008 5:37 pm Post subject: |
|
|
Enlight wrote: | geekounet wrote: | Sinon avec zsh :
|
Wow, c'est tellement moche que j'ai cru que c'était du ruby!
ben quoi le thread est déjà parti en troll, non? |
T'exagères, ça ressemble quand même à du code le Ruby |
|
Back to top |
|
|
|