NDV wrote:
Bonjour a tous,

Je voudrais bien faire un rm -rf des fichiers d'une taille superieure a
5 kilobytes & plus vieux de 7 jours contenu dans /home/ (par exemple) et
sous repertoires.

Je suis loin d'etre un scripteux, freshmeat.net et google.com/linux me donnent
des liens mais uniquement vers des *sharewares*.
Auriez-vous d'autres pistes? Liens vers un programme efficace?
man find
find [path...] [expression]
...
TESTS
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.
...
-atime n
File was last accessed n*24 hours ago.
...
-size n[bckw]
File uses n units of space. The units are 512-byte
blocks by default or if `b' follows n, bytes if `c'
follows n, kilobytes if `k' follows n, or 2-byte
words if `w' follows n. The size does not count
indirect blocks, but it does count blocks in sparse
files that are not actually allocated.
...
ACTIONS
-exec command ;
Execute command; true if 0 status is returned. All
following arguments to find are taken to be argu�
ments to the command until an argument consisting
of `;' is encountered. The string `{}' is replaced
by the current file name being processed everywhere
it occurs in the arguments to the command, not just
in arguments where it is alone, as in some versions
of find. Both of these constructions might need to
be escaped (with a `\') or quoted to protect them
from expansion by the shell. The command is exe�
cuted in the starting directory.

donc qqchose du genre:
find /home -size +5k -atime +7 -exec rm -rf '{}' ';'

� v�rifier bien entendu (essaie de le lancer sans l'action qqchose comme ceci:
find /home -size +5k -atime +7 -exec ls -lh '{}' ';'

chez moi �a fait bcp de fichiers (12587!), fais attention ;-)

--
_ _
( "> Thomas Silvestre <� )
(v ) AEL activist ( <)
--- ---
"Si tu arrives au sommet de la montagne, continue de grimper!"
- Bouddha .

_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
Archives: http://www.mail-archive.com/linux@;lists.unixtech.be
IRC: efnet.skynet.be:6667 - #unixtech


Répondre à