rbj@uunet.UU.NET (Root Boy Jim) (03/26/91)
In article <SQUASH.91Mar15194116@heat.math.ufl.edu> squash@math.ufl.edu (Jonathan King) writes: >My .logout contain a call to _find to automatically remove files >satisfying certain criteria. I would like the file's name to provide >the criterion. For example, files > > letter.rm.60.tex > c_hack.rm.120.c > >would be automatically removed if unmodified for 60 and 120 days. > (Of course, I could put the specific numbers "60" and "120" into my > call to _find. I would like this to work, automatically, for all > numbers that are valid to, say, the -mtime switch of _find.) >Can this be done by _find or by some other program? If you can limit yourself to a small number of days, then try: for days in 30 60 90 120; do find . -name "*.rm.$days.*" -mtime +$days -print | xargs rm -f done Otherwise, First pick all the files matching this pattern, then process them. find ~ -name "*.rm.*.*" -print | maybe-remove Of course now you have to write the latter program. A good language to write it in would be perl. -- [rbj@uunet 1] stty sane unknown mode: sane
jik@athena.mit.edu (Jonathan I. Kamens) (03/28/91)
In article <126507@uunet.UU.NET> rbj@uunet.UU.NET (Root Boy Jim) writes:
Otherwise, First pick all the files matching this pattern, then process them.
find ~ -name "*.rm.*.*" -print | maybe-remove
Of course now you have to write the latter program.
A good language to write it in would be perl.
If maybe-remove is written in perl, then it is ridiculous to do the
find in a separate process, since the perl can do it in the same
process as the maybe-remove stuff.
Doesn't the perl distribution come with "find2perl" or something like
that?
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik@Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710