Check for number of times a file has been accessed

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
nathan323
Posts: 9
Joined: 02 May 2014 04:44

Check for number of times a file has been accessed

#1 Post by nathan323 » 03 Oct 2014 05:55

I want to write a batch file that checks if a particular file has been accessed a certain number of times, then deletes it if it has.

Is this attribute even stored by Windows?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Check for number of times a file has been accessed

#2 Post by foxidrive » 03 Oct 2014 05:59

No.

If the file is accessed by running a batch file then the script can keep track.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Check for number of times a file has been accessed

#3 Post by Squashman » 03 Oct 2014 08:40

The only way you would be able to do this is to turn on File Auditing in Group Policy. But you would then have to figure out a way to parse the Log files. A batch file would not be able to read the log files in Event Viewer as far as I know without some kind of 3rd party utility.

nathan323
Posts: 9
Joined: 02 May 2014 04:44

Re: Check for number of times a file has been accessed

#4 Post by nathan323 » 03 Oct 2014 16:13

Ok, thanks.

Post Reply