Crafty automatic file deletion?

Jonathan I. Kamens jik at athena.mit.edu
Mon Mar 18 13:15:47 AEST 1991


  (I have cross-posted this response to comp.unix.questions, and directed
Followups there.  I don't really see any reason to consider this a
wizard-level discussion.)

In article <SQUASH.91Mar15194116 at heat.math.ufl.edu>, squash at math.ufl.edu (Jonathan King) writes:
|> [Asks if there's any utility that can parse a filename and figure out from
|>  it when to delete it.]

  The only way find is going to be able to do this is if you give it explicit
arguments for each number you want to check for; this doesn't seem to be what
you want to do.

  In general, the utilities that can do string manipulation understand nothing
at all about file modification times, and the utilities that understand mtimes
don't understand how to do any string manipulation, so you'll have to use
multiple processes to get anything approaching the functionality you're trying
to achieve, unless you write your own C program to do it.

  Or, you could use perl.  Perl can do the recursive file search, it can parse
the filenames in order to extract from them a number to check against, and it
can stat the file in order to get the modification time.  All this in one
process.

  No, I'm not going to volunteer a perl script to do this.  I'm not enough of
a perl guru to be able to throw one together in five minutes.  I'm sure
Randall or Tom or Larry will jump right in and suggest something. :-)

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list