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?
Check for number of times a file has been accessed
Moderator: DosItHelp
Re: Check for number of times a file has been accessed
No.
If the file is accessed by running a batch file then the script can keep track.
If the file is accessed by running a batch file then the script can keep track.
Re: Check for number of times a file has been accessed
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.