I have an executable program (no source code) that creates temporary files in a certain folder then deletes them at the end. I am having trouble with the program and would like to examine the temporary files to see if there's anything I can do without changing the source.
Is there a way I can prevent the program from deleting files, or alternatively prevent all programs from deleting files in a certain folder?
You can change the ACL on the folder in question so that the account running the executable (most likely you) can create, write, edit files in there, but not delete. Two issues:
You would of course possibly cause the program to crash
You will have to regain control of the folder afterwards (take ownership, reset all permissions etc) to be able to delete the files
Since it's making the files, the user it's running as is the owner on the files and will be able to delete them, so I don't think there's anything you can configure for NTFS CACLS on the parent directory in advance.
You could try to open the files in another program yourself to see if that will prevent deletion. You could also try copying and/or moving the files as soon as they are created into another folder.