phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) (03/30/91)
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. Before I start writing something to do this, I would like to ask if it has already been done. If it takes the date in the same form as "ls -l" types it, or can copy the dated from a named file, that would be great. I would do the latter form if I have to as it would avoid having to code and conversion of anything. -- /***************************************************************************\ / Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks / \***************************************************************************/
pfalstad@phoenix.Princeton.EDU (Paul Falstad) (03/30/91)
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 <sys/types.h> #include <sys/stat.h> #include <sys/time.h> 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.