Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!sol.ctr.columbia.edu!emory!att!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul Falstad) Newsgroups: comp.unix.questions Subject: Re: setting or retaining the date of a file Message-ID: <7718@idunno.Princeton.EDU> Date: 30 Mar 91 07:04:11 GMT References: <1991Mar30.054345.767@ux1.cso.uiuc.edu> Sender: news@idunno.Princeton.EDU Organization: League For Fighting Chartered Accountancy Lines: 31 phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) wrote: >I have a bunch of files in which the date of the file has a particular >meaning to me. I want to retain the dates. However I also want to sort >these files as well. I don't want to end up with a bunch of sorted files >dated today. I believe the system V version of touch can change file datestamps. At least, /usr/5bin/touch on a SunOS system can do it. Of course, it's trivial to write (this is sans error checking): #include #include #include main(argc,argv) int argc; char **argv; { struct stat buf; struct timeval x[2]; stat(argv[1],&buf); x[0].tv_sec = buf.st_atime; x[1].tv_sec = buf.st_mtime; utimes(argv[2],x); } -- Paul Falstad, pfalstad@phoenix.princeton.edu | 10 PRINT "PRINCETON CS" [Your blood pressure just went up.] | 20 GOTO 10 Princeton University would like to apologize to everyone for this article.