Various types of operations such as files, directories, text files, etc.

Source: Internet
Author: User
Tags chr end file size return


<%
Dim Myfilefolder
Set Myfilefolder = New filefoldercls
' Response.Write myfilefolder.moveafile ("F:\123\4561.exe", "F:\123\4562.txt")
' Response.Write Myfilefolder.moveafolder ("f:\456", "f:\ditg\456")
' Response.Write Myfilefolder.showfilesystemtype ("I:\")
' Response.Write myfilefolder.copyafile ("F:\123\4562.txt", "F:\123\4563.txt")
'!!!!
' Response.Write Myfilefolder.copyafolder ("f:\123\", "f:\789\")
' Response.Write myfilefolder.showfolderlist ("F:\DITG")
' Response.Write myfilefolder.showfilelist ("f:\123\123")
' Response.Write myfilefolder.deleteafile ("F:\123\4562.txt")
' Response.Write Myfilefolder.deleteafolder ("f:\456\")
' Response.Write Myfilefolder.createfolderdemo ("f:\147\")
' Response.Write myfilefolder.getfilesize ("F:\123\4563.txt")
' Response.Write myfilefolder.getfoldersize ("F:\123\123.txt")
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 1) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 2) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 3) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 4) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 5) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 6) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 7) & "<br>"
' Response.Write myfilefolder.showfileaccessinfo ("F:\123\123.txt", 8) & "<br>"

' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 1) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 2) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 3) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 4) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 5) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 6) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 7) & "<br>"
' Response.Write myfilefolder.showfolderaccessinfo ("f:\123\", 8) & "<br>"

' Response.Write myfilefolder.writetxtfile ("F:\123\cexo.txt", "" ", 1) &" <br> "
' Response.Write myfilefolder.writetxtfile ("F:\123\cexo.txt", "CEXOWXFDW", 1) & "<br>"
' Response.Write myfilefolder.writetxtfile ("F:\123\cexo.txt", Chr &AMP;CHR (10)

& "CEXOWXFDW", 2) & "<br>"
' Response.Write myfilefolder.readtxtfile ("F:\123\cexo.txt") & "<br>"
Response.Write myfilefolder.displayleveldepth ("F:\ditg\ditg\bumen\images") & "<br>"

Class Filefoldercls
Public FSO

Private Sub Class_Initialize ()
Set fso = CreateObject ("Scripting.FileSystemObject")
End Sub

Private Sub Class_Terminate ()
Set FSO = Nothing
End Sub

'//================================== file Operation ==================================

' Take file size
Function GetFileSize (FileName)
'//function: Take file size
'//formal parameter: filename
'//Return Value: Success for file size, failure to-1
'//
Dim F
If reportfilestatus (FileName) = 1 Then
Set f = fso. Getfile (FileName)
GetFileSize = F.size
Else
GetFileSize =-1
End If
End Function

' File deletion
Function Deleteafile (filespec)
'//function: File deletion
'//formal parameter: filename
'//Return Value: Success is 1, failure is-1
'//
If reportfilestatus (filespec) = 1 Then
Fso. DeleteFile (filespec)
Deleteafile = 1
Else
Deleteafile =-1
&nbs



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.