Hello Tony,
Thanks for the example!
Your little script solved my problem.
Kind regards,
Paul Keur
-----Oorspronkelijk bericht-----
Van: Santauro [mailto:santauro@a...]
Verzonden: woensdag 17 juli 2002 15:08
Aan: Security_asp
Onderwerp: [security_asp] RE: Changing attributes of files and dir's
using asp??
Urgentie: Hoog
Dear Paul,
I hope this little script I put together helps you out. It creates a text
file and a folder, and then changes the attributes of those in ASP.
Let me know if this is what you were after.
<%@ language =3D "VBscript" %>
<%
option explicit
' DECLARE VARIABLES
Dim objFSO, objTextStream, objFile, attribType, objFolder
' INSTANTIATE FILESYSTEM OBJECT OBJECT VIA
Set objFSO =3D Server.CreateObject("Scripting.FileSystemObject")
' CREATETEXTFILE METHOD OF FSO OBJECT
Set objTextStream =3D
objFSO.CreateTextFile("C:\Windows\DESKTOP\TextStreamFile.txt", true, fals
e)
objTextStream.Write "This is a newly created text file. And we will chang
e
the attributes on the fly."
objTextStream.Close
' NOW ACCESS FILE OBJECT BY USING THE GETFILE METHOD OF THE FILESYSTEMOBJ
ECT
OBJECT
Set objFile =3D objFSO.GetFile("C:\windows\DESKTOP\TextStreamFile.txt")
' ATTRIBUTE TYPES
' 0 =3D Normal
' 1 =3D ReadOnly
' 2 =3D Hidden
' 4 =3D System
' 32 =3D Archive
' SET THE FILE OBJECT'S ATTRIBUTES PROPERTY
objFile.Attributes =3D 32
' ----------------------------------------------------------------------
' CREATEFOLDER METHOD OF FSO OBJECT
objFSO.CreateFolder("c:\windows\DESKTOP\testFolder")
' REFER TO ATTRIBUTE TYPES ABOVE USED WITH FILE OBJECT TO APPLY VALUES TO
FOLDER OBJECT
' GETFOLDER METHOD OF FSO
Set objFolder =3D objFSO.GetFolder("c:\windows\DESKTOP\testFolder")
objFolder.Attributes =3D 1
%>
Regards,
Tony Santauro
Santauro Solutions
phone - (02) 42 859596
mobile - 0425 22 00 61
email - santaurosolutions@h...
URL - www.santaurosolutions.com
postal address - PO BOX 2038 Tarrawanna NSW 2518
-----Original Message-----
From: Paul Keur [mailto:paul@d...]
Sent: Thursday, 18 July 2002 1:00 PM
To: Security_asp
Subject: [security_asp] Changing attributes of files and dir's using asp?
?
Hello,
Is there someone outthere who can tell me if it is possible to change the
attributes of files and dir's on the fly using asp on IIS 5 and if it is
possible how to do this?
Regards,
Paul
to unsubscribe send a blank email to leave-security_asp-1147175T@p...
.com.
#########################################################################
############
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal
For more information please visit www.marshalsoftware.com
#########################################################################
############