Back Date A File Using Terminal 1


Back Date A File Using Terminal


This is quite a fun or useful trick which you can use to change the date of any file or folder. Its useful if you need to previously date a file for what ever reason, you can also date something in the future if needs be. This trick, like most on this site, using Terminal. You need to be a little bit proficient using Terminal with this trick otherwise you could screw things up.

Open Terminal. This trick is a one liner and takes the following syntax

touch -t 20090101050202 /location/of/file/filename.png

The first part of the file is pretty obvious, we are using the touch command which is really useful and is designed to change file access and modification times. The next part of it is the number, this is the date of the file in reverse order. 20090101050202 = YYYYMMDDhhmmss, year month day hour minute second. You can omit the seconds section, you really don’t need it.

Once as you hit return and everything is done correctly the file access time will have change to what you have imputed.

In the future I will be going through the touch command more, as it is a quite useful.

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