Unix Question

Jerry Peek jerryp at tektools.UUCP
Tue Nov 11 02:44:42 AEST 1986


In article <249 at sjuvax.UUCP> cc743805 at sjuvax.UUCP (conway) writes:
>      How can one change the date/time stamp of a file?

If you can write the C code, use utimes(2) and/or utime(3).

I have a program named "setd" that someone else here at Tek wrote; it does
just what you want.  It runs on BSD VAXen; I dunno about Sys V or other OS'es.
If anyone wants a copy, let me know -- I should ask the author's permission
first, but I don't think it'd be any problem.  Here's part of the man page:

	setd(1)             UNIX Programmer's Manual              setd(1)

	NAME
	     setd - Sets file(s) date/time to desired time.

	SYNOPSIS
	     setd [+ma] [-[mm/dd/yy][,hh:mm:ss]] file1 [file2] ...

	DESCRIPTION
	     This program will let you change the date/time on  any  file
	     to  exactly the date that you want. Allowable dates are from
	     January 1, 1980 to December 31, 2037.
	     The  program  uses  the  utime()  call  from  C. This always
	     updates the last inode changed time  (sometimes  called  the
	     creation  time).  The modification and last access times are
	     updated to the specified time unless  the  options  '+m'  or
	     '+a' are specified. If '+m' is specified, only the modifica-
	     tion time on the file is changed. If '+a' is specified, only
	     the  last  access  time  on  the  file is changed. If '+' is
	     specified without any arguments, neither the last access  or
	     modification  times  are changed, but the last inode-changed
	     time is updated to the current time.

--Jerry Peek, Tektronix, Inc.
US Mail:    MS 74-900, P.O. Box 500, Beaverton, OR 97077
uucp:       {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp
CS,ARPAnet: jerryp%tektools at tektronix.csnet
Phone:      +1 503 627-1603



More information about the Comp.unix.questions mailing list