How to Changing a file’s “Date Created” and “Last Modified”

faqHow to Changing a file’s “Date Created” and “Last Modified”

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 was created with some arbitrary timestamp.

$ touch -d 20120101 file-name
$ ls -l file-name
-rw-rw-r--. 1 east4serv east4serv 0 Jan 1 2012 file-name




Have a nice day ?

 

Share Button