Linux Change Modification Date of Files

If you want to modified date of files on linux, you can follow this steps:

You could cd to the folder containing the the files and:

touch -d '30 August 2013' *.php

Or if it has sub folders with php files – search through them recursively:

find /path/to/your/php/ -exec touch -d '30 August 2013' *.php {} \;

the folder ‘php’ in the command above would be included.

Edit:

If you ONLY need to find/change EXACTLY files modified on 23 April 2013, you can use the -mtimeparameter in your find command.

  • -mtime +60 means you are looking for a file modified 60 days ago or more.
  • -mtime -60 means less than 60 days.
  • -mtime 60 If you skip + or - it means exactly 60 days.

So modifying the command above like this:

find /path/to/your/php/ -mtime 127 -exec touch -d '30 August 2013' *.php {} \;

Where 127 is the exact amount of days since 23 April (if my quick head calculation is correct). Else you can change the number to the correct amount of days, or use the + or - as described above if it doesn’t need to be ‘that’ exact.

You can read more about the find commands -mtime parameter here: http://www.cyberciti.biz/faq/howto-finding-files-by-date/

 

source: http://stackoverflow.com/questions/18522501/linux-change-modification-date-of-files


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *