Enable Last Access timestamp for files and folder in Windows

Last updated on 09th January 2017

Last access timestamp of a file is the last date and time when that file was opened for reading or writing. So every time a user access a file this timestamp needs to be updated, which is a bit of an overhead especially if you are not too keen on this file attribute. To improve the performance of NTFS filesystem in Windows 10 (and previous versions starting from Windows Vista) the last access times of files and directories are NOT updated.

Let's try this

  • Create a text file and save it.
  • Right click the file icon and bring up the properties sheet.
  • Note down the Created, Modified, and Accessed date and times.
  • Now open the file in a Notepad and close it without making any changes.
  • Check the file timestamps again, you'll notice nothing has changed eventhough you have opened the file for read.
  • Open the file again and add some text in it, save.
  • Check the timestamps, you'll see the modified time has changed as you would expect but still no change to the accessed time.

So why do we still need the accessed time attribute if its not being updated? Lets say you have a backup application that backsup files that are accessed after a specified date or an archiving software which moves all files that are not accessed in the last six months to a secondary storage location. Such applications need to know accurate last accessed time of your files. In this case you can enable updating the last access time using fsutil tool.

fsutil is a command line tool to perform task related to NTFS and FAT filesystems. fsutil command can query and also set the NTFS volume behavior parameter DisableLastAccess which controls whether access times are updated or not.

  • DisableLastAccess = 1 means Last access time updates are disabled.
  • DisableLastAccess = 0 means Last access time updates are enabled.

Commands to Enable, disable and query last access time updates

Open an elevated command prompt. Right click Windows Start button and select Command Prompt (Admin). To check the Last access time updates are enabled or not, run:

C:\> fsutil behavior query disablelastaccess
DisableLastAccess = 1

To enable Last access time update:

C:\> fsutil behavior set disablelastaccess 0
DisableLastAccess = 0

To disbale Last access time update:

C:\> fsutil behavior set disablelastaccess 1
DisableLastAccess = 1

After making any change you must restart the computer for the changes to take place.


Post a comment

Comments

Rich | July 2, 2019 9:50 PM |

I just tried this on 7/2/2019 on windows 10 and it says access is denied. Almost everything I do requires admin approval but I am an admin.

Marcelo | October 23, 2019 9:06 PM |

"Open an elevated command prompt"

matan | June 14, 2019 10:27 AM |

thank you so so match!

Mikael | June 22, 2018 7:50 AM |

Thank you, just what I needed!

aaron | May 4, 2018 9:45 AM |

microsoft updated this in the april 2018 creators update. it now has 4 options. option 3 is system managed disabled (allows system to decide),option 2 is system managed enabled, option 1 is user managed disabled, and 0 is user managed enabled.

aaron | May 21, 2018 1:56 AM |

Thanks for correcting me.

John | May 20, 2018 5:14 PM |

Option 1 is: DisableLastAccess = 1 (User Managed, Enabled) Option 0 is : DisableLastAccess = 0 (User Managed, Disabled) You go them reversed in your post aaron ;)

leon | December 9, 2017 1:38 AM |

very good