ASP file related information and directory-related information

Source: Internet
Author: User

' Parameter: File name (relative path)
' Return value: 0 size 1 Create Time 2 Last modified 3 last browse time 4 path 5 type 6 name
Public Function GetFileInfo (FileName)
Dim f,temp
Dim file (7)
On Error Resume Next
temp = Server.MapPath (FileName)
If ofso.fileexists (temp) Then
Set f = ofso.getfile (temp)
File (0) = Lib.formatnumberstr (f.size/1024,1) & "KB"
File (1) = Lib.dateformat (f.datecreated, "y-m-d h:n:s")
File (2) = Lib.dateformat (f.datelastmodified, "y-m-d h:n:s")
File (3) = Lib.dateformat (f.datelastaccessed, "y-m-d h:n:s")
File (4) = F.path
File (5) = F.type
File (6) = F.name
End If
If Err <> 0 Then Err.Clear
GetFileInfo = File
Set F = Nothing
End Function

' Function: Access to directory-related information
' Parameter: Directory name (relative path)
' Return value: 0 size 1 Create Time 2 Last modified 3 last browse time 4 path 5 type 6 name
Public Function Getfolderinfo (folderName)
Dim f,temp
Dim folder (7)
On Error Resume Next
temp = Server.MapPath (folderName)
If ofso.folderexists (temp) = True Then
Set f = ofso.getfolder (temp)
folder (0) = Lib.formatnumberstr (f.size/1024,1) & "KB"
folder (1) = Lib.dateformat (f.datecreated, "y-m-d h:n:s")
Folder (2) = Lib.dateformat (f.datelastmodified, "y-m-d h:n:s")
Folder (3) = Lib.dateformat (f.datelastaccessed, "y-m-d h:n:s")
Folder (4) = F.path
Folder (5) = F.type
folder (6) = F.name
End If
If Err <> 0 Then Err.Clear
Getfolderinfo = Folder
Set F = Nothing
End Function

%>

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.