Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Last access date and time
I'm trying to write a function that will tell me if someone has accessed a file from a share on my drive. I'll have the function create a file on my desktop and then begin a rep command that firsts checks for the existence of the file and then looks at a dir and sees if the lastaccess date and time are within 60 seconds of the current system time. It then dumps out the file name and time into a log file.

The problem I'm having is that I can't figure out how to get that last access date and time out and compare it to the system time. Does any one have an idea on how to do that?


BTW: if the file gets deleted from my desktop the function stops...not elegant but it works....
Function GetFileInfo would do it but problem is that file system stores last access time with 1 day or 1 hour precision. Created and modified times are stored with 2 s precision. I tried SetFileTime but it does not change last access time.

Forum Jump:

Users browsing this thread: 1 Guest(s)