ASP FSO Settings/Read file (folder) attributes detailed

Source: Internet
Author: User

Cases

The code is as follows Copy Code

<HTML>
<HEAD><TITLE> Get file Property Code </TITLE></HEAD>
<BODY>
<%
' Create a case of a FileSystemObject object
Set myfileobject=server.createobject ("Scripting.FileSystemObject")
' Create a case of a file object
Filename=server.mappath ("./") & "Test.html"
Set myfile=myfileobject.getfile (filename)
%>
<Br> name £ <%=myfile.name%>
<Br> Path: <%=myfile.path%>
<Br> Drive: <%=myfile.drive%>
<Br> File Size: <%=myfile.size%>
<Br> file type: <%=myfile.type%>
<Br> file properties: <%=myfile.attributes%>
<Br> Date Created: <%=myfile.datecreated%>

<Br> last accessed time: <%=ff. Datelastaccessed%>

<Br> Last modified: <%=ff. Datelastmodified%>

</BODY>
</HTML>


FSO to generate files and set their properties

The code is as follows Copy Code

<%
' Create a case of a FileSystemObject object
Set Myfileobject=server.createobject ("Scripting.FileSystemObject")
' Create a case of a file object
Set Myfile=myfileobject.getfile (Server.MapPath ("1.txt"))
' Set its properties to read-only
Myfile.attributes=1
%>

Principle

When the FSO creates the file, it returns a TextStream object ...
And the FSO to set the properties of a file or folder. You must get a file or Folder object.
Sir into the document. Then use the getfile to get the file object of this document. And then set its Attributes property value, it's OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.