none
Is there any way of tracking or counting how many times a file has been opened since creation? RRS feed

  • Question

  • I basically need to be able to track how many times a file has been opened after being created in a certain directory. I want to keep track of the most used files on that particular directory.

    Can I get the info on how many times a file has been opened since creation?

    Thursday, October 26, 2017 11:39 AM

Answers

  • The FileSystemWatcher class exposes events you can subscribe to, however when the process terminates, so does the ongoing monitoring.
    • Marked as answer by OCS.New Monday, October 30, 2017 2:44 PM
    Thursday, October 26, 2017 12:00 PM
  • No. Windows does not track the # of times a file has been accessed. It doesn't even track the # of times a file has been written. The only stats that are available is the last write time. Last access is deprecated and not used in newer versions so that isn't helpful either.

    The only way to track this info is by either writing a virtual file provider (if you want arbitrary directories) or add that functionality to your file viewer program (assuming you want to monitor only files that your app can open).


    Michael Taylor http://www.michaeltaylorp3.net

    • Proposed as answer by Fei HuModerator Friday, October 27, 2017 7:26 AM
    • Marked as answer by OCS.New Monday, October 30, 2017 2:44 PM
    Thursday, October 26, 2017 2:06 PM
    Moderator

All replies

  • The FileSystemWatcher class exposes events you can subscribe to, however when the process terminates, so does the ongoing monitoring.
    • Marked as answer by OCS.New Monday, October 30, 2017 2:44 PM
    Thursday, October 26, 2017 12:00 PM
  • No. Windows does not track the # of times a file has been accessed. It doesn't even track the # of times a file has been written. The only stats that are available is the last write time. Last access is deprecated and not used in newer versions so that isn't helpful either.

    The only way to track this info is by either writing a virtual file provider (if you want arbitrary directories) or add that functionality to your file viewer program (assuming you want to monitor only files that your app can open).


    Michael Taylor http://www.michaeltaylorp3.net

    • Proposed as answer by Fei HuModerator Friday, October 27, 2017 7:26 AM
    • Marked as answer by OCS.New Monday, October 30, 2017 2:44 PM
    Thursday, October 26, 2017 2:06 PM
    Moderator
  • Hello OCS,

    Is there anything updated? If you are satisfied with the reply, you could close the thread by marking as answer, this can be beneficial to other community members reading this thread.

    Sincerely,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Sunday, October 29, 2017 5:10 AM
    Moderator