What is the syntax for assigning file permissions on individual files and folder on a WinNT based server?<BR>I would like to accomplish this without using third party products. Most especially without using dlls.
Use the asp file system objects.<BR><BR>example:<BR><BR><% <BR><BR>dim fso<BR>dim some_file<BR>dim some_folder<BR><BR>const Normal = 0<BR>const ReadOnly = 1<BR>const Hidden = 2<BR>const System = 4<BR>const Archive = 32<BR><BR>set fso = server.createobject("scripting.FileSystemObject")< BR>set some_file = fso.getfile("c:autoexec.bat")<BR>'Here's the important line of code <BR>some_file.attributes = (Normal + ReadOnly + Hidden + System + Archive)<BR><BR>set some_folder = fso.getfolder("c:windows")<BR>... <BR>
It can't be done (and if it can, it really shouldn't -- I saw some VB code for this on MSDN that was nothing short of horrid. I don't think it would port to VBScript. But it's in the support knowledge base if you're that desperate).<BR><BR>If you can convince your ISP to use a 3rd party COM object, my frequently-made suggestion is Software Artisans SA-FileManager. (afaik, it's a free download from www.softwareartisans.com) It does (probably) anything you could want to do to a file on a single machine. It also contains the .LogonUser capability which you'll want to use when you're changing security settings on files.<BR><BR>Not what you wanted to hear, but just think of how many permissions-changing email viruii haven't been written because VBScript can't do it!