Home

Linux touch change file timestamp

To integrate them into the pictures I took during the tour, I'd like to change the timestamp given the file names. (That's the reverse of what people usually need. ) The files will all be in their own directory, so I need to read the entire directory and touch the files according to the characters in the file name.

How can I change the timestamp on a file? [duplicate Ask Question. up vote 56 down vote favorite. 34. The two current answers assume you are looking for a Windows port of the Unix command touch that sets a files's timestamp to the current time.

Are you implying that you want to be able to change the timestamp to an arbritary time of Jan 09, 2013 " touch" will only change the content of the inode of a file (the modification timestamp), but not change the contents of the file itself. I Changing file timestamps to a specific date and time. If you have a specific time and date you would like to be used for all the timestamps of a file or directory, touch command will gladly accempt a timestamp template with t command line option.

You can use the touch command along with the r switch to apply another file's attributes to a file. NOTE: There is no such thing as creation date in Unix, there are only access, modify, and change.

See this U& L Q& A titled: get age of given file for further details. touch r goldenfile newfile Example. For example purposes here's a goldenfile that Every file in Linux is associated with timestamps, which specifies the last access time, last modification time and last change time.

Whenever we create a new file, or modify an existing file or its attributes, these timestamps will be updated automatically. File1. txt originally has timestamp 12: 42. After we do touch command, it changed to 17: 08. By default, touch will change the file timestamp into current time.

Change May 27, 2008 I want to modify a file and then change the file's timestamp back to what it was before the modification. It should look as if the file has'nt been modifed. The entire operation needs to be done inside a ksh Linux touch change file timestamp.

Can anyone suggest how I can trap a file's stamp in a variable within a shell. Thanks in advance.