jerryp@tektools.UUCP (Jerry Peek) (11/10/86)
In article <249@sjuvax.UUCP> cc743805@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@tektronix.csnet Phone: +1 503 627-1603
adam@mtund.UUCP (Adam V. Reed) (11/10/86)
> I'll make this short and sweet: > > How can one change the date/time stamp of a file? > > I want to be able to put any date/time on a file that I > have in my directory. Is this possible? If this question > has been discussed before, please forgive me. I don't > usually read this group. > > Chuck Conway > -- > ______________________________________________________________ > | Chuck Conway, St. Joseph's University | > | {bpa|burdvax|princeton|allegra}!sjuvax!cc743805 | > | cc743805@sjuvax.UUCP | > |------------------------------------------------------------| See touch(1) in the User Reference Manual (RTFM!).
steve@umcp-cs.UUCP (Steve D. Miller) (11/11/86)
In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >> I'll make this short and sweet: >> >> How can one change the date/time stamp of a file? >> >> I want to be able to put any date/time on a file that I >> have in my directory... >> Chuck Conway > >See touch(1) in the User Reference Manual (RTFM!). The original poster does not want to put the *current* time on the file...he wants to put *any* time on the file. There are three timestamps associated with any file: the last access time, the last modify time, and the "last time inode modified" time (the a_time, m_time, and c_time fields of the structure returned by stat(2)). The utimes(2) system call is probably the one you want; it will set the access and modify times to whatever you wish, and set the inode change time to the current time. See the manual entry. If you need to set the inode change time, you will have to fool with the raw disk device. If you really need to do so, I can probably scrounge up more information for you. -Steve -- Spoken: Steve Miller ARPA: steve@mimsy.umd.edu Phone: +1-301-454-4251 CSNet: steve@umcp-cs UUCP: {seismo,allegra}!umcp-cs!steve USPS: Computer Science Dept., University of Maryland, College Park, MD 20742
psfales@ihlpl.UUCP (Peter Fales) (11/12/86)
> >> I'll make this short and sweet: > >> > >> How can one change the date/time stamp of a file? > > > >See touch(1) in the User Reference Manual (RTFM!). > The original poster does not want to put the *current* time on > the file...he wants to put *any* time on the file. There are three Don't be so quick to shoot down the original answer. touch(1) can do exactly what you want with no need to mess with inode tables. Pete Fales ihnp4!ihlpl!psfales
normt@ihlpa.UUCP (N. R Tiedemann) (11/12/86)
> In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: > >> I'll make this short and sweet: > >> I want to be able to put any date/time on a file that I > >> have in my directory... > >> Chuck Conway > > > >See touch(1) in the User Reference Manual (RTFM!). > > The original poster does not want to put the *current* time on > the file...he wants to put *any* time on the file. There are three > Spoken: Steve Miller ARPA: steve@mimsy.umd.edu Phone: +1-301-454-4251 Steve- READ YOUR UNIX MANUAL!!!! Mine states under TOUCH(1) ... causes the access and modification times of each argument to be updated. IF NO TIME IS SPECIFIED THE CURRENT TIME IS USED. You can specify the time you want it touched to. This is exactly what the original poster wanted. touch [ -amc] [mmddhhmm[yy] ] files This give you month date hour minute and year, what more could you want?!? Norm Tiedemann ihnp4!ihlpa!normt AT&T Bell Labs
ask@cbrma.UUCP (A.S.Kamlet) (11/13/86)
In article <4287@umcp-cs.UUCP> steve@umcp-cs.UUCP (Steve D. Miller) writes: >In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >>> I'll make this short and sweet: >>> >>> How can one change the date/time stamp of a file? >>> >>> I want to be able to put any date/time on a file that I >>> have in my directory... >>> Chuck Conway >> >>See touch(1) in the User Reference Manual (RTFM!). > > The original poster does not want to put the *current* time on >the file...he wants to put *any* time on the file. There are three >timestamps associated with any file: the last access time, the >last modify time, and the "last time inode modified" time (the >a_time, m_time, and c_time fields of the structure returned by >stat(2)). The utimes(2) system call is probably the one you >want; it will set the access and modify times to whatever you >wish, and set the inode change time to the current time. See >the manual entry. > > If you need to set the inode change time, you will have to >fool with the raw disk device. If you really need to do so, >I can probably scrounge up more information for you. > According to my SVR2 manual, touch(1) can be used to change the access and/or modification times to current time (default) or to an optional time. -- Art Kamlet AT&T Bell Laboratories Columbus {cbosgd | ihnp4}!cbrma!ask
gore@nucsrl.UUCP (Jacob Gore) (11/13/86)
>>>> I'll make this short and sweet: >>>> >>>> How can one change the date/time stamp of a file? >>> >>>See touch(1) in the User Reference Manual (RTFM!). >> The original poster does not want to put the *current* time on >>the file...he wants to put *any* time on the file. There are three >Don't be so quick to shoot down the original answer. touch(1) can >do exactly what you want with no need to mess with inode tables. It [touch(1)] does have a time parameter on SysV, but not on 4.3BSD. You are both right... Jacob Gore Northwestern University Computer Science Research Lab {ihnp4,chinet}!nucsrl!gore
mouse@mcgill-vision.UUCP (11/13/86)
In article <249@sjuvax.UUCP>, cc743805@sjuvax.UUCP (conway) writes: > How can one change the date/time stamp of a file? > I want to be able to put any date/time on a file that I > have in my directory. Is this possible? Most versions of UNIX have a syscall to do just this; on Berkeley UNIX it is called utime or utimes. I assume it would be called something similar on AT&T systems. der Mouse USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse think!mosart!mcgill-vision!mouse Europe: mcvax!decvax!utcsri!mcgill-vision!mouse ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu [USA NSA food: terrorist, cryptography, DES, drugs, CIA, secret, decode]
ken@rochester.ARPA (SKY) (11/13/86)
|Steve- READ YOUR UNIX MANUAL!!!! Mine states under TOUCH(1) ... causes the |access and modification times of each argument to be updated. Alright already! Stop flaming at each other. Obviously your Unix has fancy options to touch(1). Mine (BSD 4.2) doesn't. Don't assume everybody's Unix is the same as yours. Ken
ggs@ulysses.UUCP (Griff Smith) (11/13/86)
> > >> I'll make this short and sweet: > > >> > > >> How can one change the date/time stamp of a file? > > > > > >See touch(1) in the User Reference Manual (RTFM!). > > > The original poster does not want to put the *current* time on > > the file...he wants to put *any* time on the file. There are three > > Don't be so quick to shoot down the original answer. touch(1) can > do exactly what you want with no need to mess with inode tables. > Bell Labs people: please don't assume System V is The Only Choice. Silly name calling like the above doesn't help what's left of our credibility. Yes, the System V version of "touch" allows specification of a date-time. It also works on any file owned by the toucher, including directories and special files. 4BSD users: please be more specific in your questions; include the system version if you know it. Given that the BSD version of "touch" only works if you have permission to append nothing to a file, I appreciate your frustration. -- Griff Smith AT&T (Bell Laboratories), Murray Hill Phone: (201) 582-7736 UUCP: {allegra|ihnp4}!ulysses!ggs Internet: ggs@ulysses.uucp
straka@ihlpf.UUCP (Straka) (11/13/86)
> In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: > >> How can one change the date/time stamp of a file? > >See touch(1) in the User Reference Manual (RTFM!). > The original poster does not want to put the *current* time on > the file...he wants to put *any* time on the file. There are three ... > want; it will set the access and modify times to whatever you > wish, and set the inode change time to the current time. See > the manual entry. > If you need to set the inode change time, you will have to > fool with the raw disk device. If you really need to do so, No, no, no. 'touch' provides the current time stamp as a *default*. The syntax (at least on SVR2) for touch is: touch [ -amc ] [ mmddhhmm[yy] ] files where -a = access time stamp only -m = modification time only -c = don't create file if non-existent This means that you can optionally set the stamp to "anything" you want to. Yes, RTFM! Rich Straka ihnp4!ihlpf!straka
bill@voodoo.UUCP (Bill Sears) (11/13/86)
In article <4287@umcp-cs.UUCP> steve@umcp-cs.UUCP (Steve D. Miller) writes: >In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >>> I'll make this short and sweet: >>> >>> How can one change the date/time stamp of a file? >>> >>> I want to be able to put any date/time on a file that I >>> have in my directory... >>> Chuck Conway >> >>See touch(1) in the User Reference Manual (RTFM!). > > The original poster does not want to put the *current* time on >the file...he wants to put *any* time on the file. There are three I don't know if it's standard or not, but at least one version of touch that I've used allowed the user to enter a time/date on the command line to touch onto the file. For example: touch 8603241425 filename.c == 2:25 pm march 24, 1986 -- Bill Sears ....uw-beaver!ssc-vax!voodoo!bill Masochist's Battle Cry - Stop it again!!! Quit it some more!!!
decot@hpisoa1.HP.COM (Dave Decot) (11/14/86)
>>> I'll make this short and sweet: >>> >>> How can one change the date/time stamp of a file? >>> >>> I want to be able to put any date/time on a file that I >>> have in my directory... >>> Chuck Conway >> >>See touch(1) in the User Reference Manual (RTFM!). > >The original poster does not want to put the *current* time on >the file...he wants to put *any* time on the file. There are three... The original respondant asked you to RTFM, and you apparently did not. The touch(1) command allows the owner of a file or the superuser to set the time(s) to *any* time: TOUCH(1) HP-UX TOUCH(1) NAME touch - update access, modification, and/or change times of file SYNOPSIS touch [ -amc ] [ mmddhhmm[yy] ] files DESCRIPTION Touch causes the access, modification, and last change times of each argument to be updated. The file name is created if it does not exist. If no time is specified (see date(1)) the current time is used. The -a and -m options cause touch to update only the access or modification times respectively (default is -am). The -c option silently prevents touch from creating the file if it did not previously exist. The return code from touch is the number of files for which the times could not be successfully modified (including files that did not exist and were not created). SEE ALSO date(1), utime(2). Dave Decot hpda!decot
adam@mtund.UUCP (Adam V. Reed) (11/14/86)
Steve Miller Writes: > In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: > >> I'll make this short and sweet: > >> > >> How can one change the date/time stamp of a file? > >> > >> I want to be able to put any date/time on a file that I > >> have in my directory... > >> Chuck Conway > > > >See touch(1) in the User Reference Manual (RTFM!). > > The original poster does not want to put the *current* time on > the file...he wants to put *any* time on the file. RTFM, and I mean it: TOUCH(1) UNIX System V TOUCH(1) NAME touch - update access and modification times of a file SYNOPSIS touch [ -amc ] [ mmddhhmm[yy] ] files DESCRIPTION Touch causes the access and modification times of each argument to be updated. The file name is created if it does not exist. If no time is specified (see date(1)) the current time is used. The -a and -m options cause touch to update only the access or modification times respectively (default is -am). The -c option silently prevents touch from creating the file if it did not previously exist. The return code from touch is the number of files for which the times could not be successfully modified (including files that did not exist and were not created). SEE ALSO date(1). utime(2) in the UNIX System Programmer Reference Manual. And yes, I tested it with an arbitrary date. It works. Adam Reed (mtund!adam)
lrj@batcomputer.tn.cornell.edu (Lewis R. Jansen) (11/14/86)
In article <810@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >Steve Miller Writes: >> In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >> >> I'll make this short and sweet: >> >> How can one change the date/time stamp of a file? >> >> I want to be able to put any date/time on a file that I >> >> have in my directory... >> >> Chuck Conway >> >See touch(1) in the User Reference Manual (RTFM!). >> The original poster does not want to put the *current* time on >> the file...he wants to put *any* time on the file. >RTFM, and I mean it: >TOUCH(1) UNIX System V TOUCH(1) > >And yes, I tested it with an arbitrary date. It works. > Adam Reed (mtund!adam) Why doesn't everyone make life a h*ll of a lot easier, and SAY WHAT VERSION YOU'RE RUNNING, ON WHAT KIND OF MACHINE. Does anyone have ANY idea how much net traffic this would cut out???? Anyway, the guy's questions seems to have been answered already, so let's shaddap already and get on with other stuff. .-----------------------------------------------------------------------------. | Lewis R. Jansen UUCP: {allegra,decvax,ihnp4,vax135}!cornell!lasspvax!lrj | | ___.-.___ Bitnet: lrj@CornellC.BITNET \batcomputer!lrj | | [' `(o)' `] Arpa: lrj@lasspvax.tn.cornell.edu.ARPA | | lrj@batcomputer.tn.cornell.edu.ARPA | | | | (Let's do lunch, have your god call my god...) | `-----------------------------------------------------------------------------'
chapman@eris.BERKELEY.EDU (Brent Chapman) (11/16/86)
In article <850@ihlpf.UUCP> straka@ihlpf.UUCP (Straka) writes: >> In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >> >> How can one change the date/time stamp of a file? >> >See touch(1) in the User Reference Manual (RTFM!). >> The original poster does not want to put the *current* time on >> the file...he wants to put *any* time on the file. There are three > ... >No, no, no. 'touch' provides the current time stamp as a *default*. >The syntax (at least on SVR2) for touch is: Key words in the above "solution": "for SVR2"... Unfortunately, 4BSD's 'touch' program doesn't provide this functionality. (Yet again, folks: when you ask a question, PLEASE state which version of UNIX you're using, what hardware, and anything else that may be useful. Remember, "All versions of UNIX are equal, but some are more equal than others." We now return you to our regularly scheduled program...) Under 4BSD, you need to use either the 'utime()' or the 'utimes()' call. You'll need to look up the details of both in the manual, and decide which one to use. Brent -- Brent Chapman chapman@eris.berkeley.edu or ucbvax!eris!chapman
defron@violet.berkeley.edu (Daniel Efron) (11/17/86)
In article <850@ihlpf.UUCP> straka@ihlpf.UUCP (Straka) writes: >> In article <808@mtund.UUCP> adam@mtund.UUCP (Adam V. Reed) writes: >> >> How can one change the date/time stamp of a file? >> >See touch(1) in the User Reference Manual (RTFM!). >> The original poster>> the file...he wants to put *any* time on the file. There are three > ... >No, no, 'touch' provides the current time stamp as a *default*. >The syntax (at least on SVR2) for touch is: O.K., enough is enough! I realize that by the time this makes it across the net most of the postings on this topic will have ceased, but . . . Please use a little common sense when posting. A question like this should probably say something like `please send mail(1) to me and I will post the best answer' to save the rest of us a lot of grief. Also give someone the benefit of the doubt, presumably one would not post until one read the man page for the obvious utility (i.e touch(1)). I can't believe all the `read the man page for touch(1)' postings. Must be that when you post news on something running SYSV that is doesn't ask you `Are you absolutely sure that you want to do this.' Finally, please do not post what you feel is an obvious answer to an obvious question, because everyone else will. - Dan Efron arpa: defron@violet.berkeley.edu uucp: ucbvax!ucbviolet!defron -
beattie@netxcom.UUCP (Brian Beattie) (11/18/86)
yes RTFM, but which FM here is MY touch ---------------------------------------------------- TOUCH(1-ucb) NAME touch - update date last modified of a file ORIGIN 4.2BSD SYNOPSIS touch [ -c ] [ -f ] file ... DESCRIPTION Touch attempts to set the modified date of each file. If a file exists, this is done by reading a character from the file and writing it back. If a file does not exist, an attempt will be made to create it unless the -c option is specified. The -f option will attempt to force the touch in spite of read and write permissions on a file. SEE ALSO utime(2) --------------------------------- come on guys forget the ATT hype there exits more than one, in fact more than two versions of UNIX out there. Hi Dave! -- ----------------------------------------------------------------------- Brian Beattie | Phone: (703)749-2365 NetExpress Communications, Inc. | uucp: seismo!sundc!netxcom!beattie 1953 Gallows Road, Suite 300 | Vienna,VA 22180 |