Change The Modification Time Of A File 1

Terminal

Share
Change The Modification Time Of A File

Hey,

Here is a rather cool trick that allows you to change the modification time of a file. There may be a variety of reasons for changing the modification time of a file, usually get an app to work with the file. Making the change is simple and involves a simple in built command within Terminal.

To change the files modification date open up Terminal located within Application > Utilities. Then type the following:

touch -mt YYYYMMDDhhmm /path/to/file

Where YYYY is the year, MM is the month, DD is the day, hh the hour and mm the minutes. For example today’s date, 16th of April, 2012 at 19:26, would be written as follows: 201204161926. You need all but values for the best effect. The path to file section can be simplified by dragging and dropping the file on to the Terminal window after you have written the command.

When you hit the return key the command will alter the modification date of the file. Note that if you modify the file in another app, the current time and date will added.

If you want to know more about the touch command you can type the following into Terminal:

man touch

This will give you the manual for the command.

If you have any questions or comments, please leave one using the form below.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips