touch (Was Re: -since option for ls -lt)

Geoff Rimmer maujd at warwick.UUCP
Tue Jun 21 23:37:06 AEST 1988


In article <344 at ajpo.sei.cmu.edu> jrkelly at ajpo.sei.cmu.edu (John Kelly) writes:
>
>Has anyone implemented any of the following for Unix:
>
>  1. a directory listing command with a -since option?
>  2. a program to force a specified modification time upon a specified file?
>  3. a program to compare two dates/times and return an appropriate status?
>
>where the dates/times are given in string form, as in the output of "date" and
>"ls"?

Although I haven't done #1, I would have thought it would be a fairly
easy C routine to write.  Use readdir(3) to step thru the files, and
stat(2) to find the modify time - then only print the info if the file
is after the time/date specified by -since.

#2 is already implemented on our (system V version) touch(1V) :-

----------------------------------------------------------------------
NAME
     touch - update times of last access and  modification  of  a
     file

SYSTEM V SYNOPSIS
     touch [ -c ] [ -a ] [ -m ] [ mmddhhmm[yy] ] filename ...

DESCRIPTION
     touch causes the access and modification times of each argu-
     ment to be set to the current time.  A file is created if it
     does not already exist.

OPTIONS
     -c   Do not create filename if it does not exist.

     -a   Update only the access time.

     -m   Update only the modification time.

     mmddhhmm[yy]
          Update the times to the specified time rather  than  to
          the current time.  The first mm is the month, dd is the
          day of the month, hh is the hour, and the second mm  is
          the  minute;  if  yy  is  specified, it is the last two
          digits of the year, otherwise the current year is used.

----------------------------------------------------------------------
Don't know about #3.

Geoff
	------------------------------------------------------------
	Geoff Rimmer, Computer Science, Warwick University, UK.
			maujd at uk.ac.warwick.opal

	"Oh, don't be so sentimental mother, things explode every day."
	------------------------------------------------------------



More information about the Comp.unix.questions mailing list