Zend certified PHP/Magento developer

bat file(batch file) that can tell if a FOLDER is opened? [closed]

I need a .bat file~(batch file?) that can tell if a FOLDER is opened by explorer(someone) but still allows a program to use that very same folder, and it need to still be running in the background; then close if a FILE is missing.

I’m trying to create a program and I don’t won’t anybody to touch the files inside of the folder.
I’ve tried the password .bat but it does not work right.
Please help, I cant think of anything.