Enable Last Access timestamp for files and folder in Windows

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

Name

Your Comment

Email (We dont publish it)

Comments

Nothing yet..be the first to share wisdom.