Top community members
All Wiki Articles Create Wiki Article

Welcome to Dirask IT community! ❤ 💻
We are community that shares solutions with each other.

If you think you have something to add here.

you are welcome with your fresh ideas - List Articles

Bash - how to reset modification date of any file

0 contributions
3 points

Easiest way is to use touch command like in this example:

$ touch path/to/file

Description: It will set current date as change, modification and access date.

If you would like to set specific date you can use -d parameter like in this example:

$ touch -d '2016-01-01 00:00:00' path/to/file 

To precise which date should be changed useful are:

  • -a - it changes only access date
$ touch -a path/to/file
$ touch -a -d '2016-01-01 00:00:00' path/to/file 
  • -m - it changes only modification date
$ touch -m path/to/file
$ touch -m -d '2016-01-01 00:00:00' path/to/file 

To copy dates from other file -r parameter can be used:

$ touch -r path/to/file1 path/to/file2

Note: file1 dates will be set to file2.

0 contributions

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more