Step to modify time stamp value of files in linux
Modify time stamp value of files in linux
We can modify time stamp value of files using the touch command. It can be changed based on Access Time, Modify Time or combination of both. To check the time stamp value of a file, please execute,
stat testfile
Please use the below commands to create a file with an older time stamp, say May 05 2013,
touch -d 20130505 testfile
Copying time stamp from existing file to new file,
touch -r testfile newtestfile
Copying time stamp from existing file to multiple new files \ existing files
touch -r testfile newtestfile newtestfile2 newtestfile3
Make changes to Access Time and Modify Time
To modify the Access Time parameter of a file, please use the switch “-a“. It will change access time to the current date and time as given below.
touch –a testfile
To make changes to “Modify Time” parameter of a file, please use the switch “-m“. It will change modify time to the current date and time as given below.