I have a batch file that copies folder from a temp directory to a public internet directory. The problem is, once the file is copied, the IUSR account doesn't have read privileges to the file and I get a 500 error. I can manually set permissions after upload, but is there an automatic way to do this for any file that gets added to the folder?
2 Answers
Microsoft has a paper called How permissions are handled when you copy and move files and folders that you should find interesting.
An easy answer is to use xcopy.exe, instead of copy. Using (at least) the following command line option, the file ACL's will remain intact:
xcopy.exe source destination /O
Got it solved. I added IUSR permissions to the windows/temp directory and it is inheriting the right permissions now.
-
For completeness, the above can be achieved programatically using ICACLS.EXE. Jul 31, 2012 at 21:38