Question:
how to change a file timestamp to previous time in unix?
anonymous
2008-07-24 14:00:21 UTC
I have a file abc.dat in home directory and I have a file in /home/appl/xyz.dat with different content in the file.
I need to copy abc.dat to xyz.dat without changing the timestamp of xyz.dat..is there any other way I can do it?
Three answers:
TK "Snobol" Erlang
2008-07-24 14:22:41 UTC
After you copy the file, use the Unix "touch" command to set the file modification time to the desired time. For example, the command:



touch -t 200806060606.06 targetFileName



will change the file "targetFileName" date to 2008-06-06 06:06.



Look at the man page for touch to get details on how to change specific dates associated with the file (man touch).
anonymous
2016-11-15 05:10:27 UTC
Change Timestamp On File
Linda
2016-03-18 11:15:36 UTC
There are numerous reasons why file would be touched... If you have several people working on a file the time stamp is updated so that everyone knows when it is was last touched and modified. The make command will rebuild a project and pass it to the compiler if the project has been touched since it was last made etc. Etc.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...