檔案、目錄,文字檔等多種操作類

來源:互聯網
上載者:User


<%
    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(13)&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

'//==================================檔案操作==================================
   
    '取檔案大小
    Function GetFileSize(FileName)
    '//功能:取檔案大小
    '//形參:檔案名稱
    '//傳回值:成功為檔案大小,失敗為-1
    '//
        Dim f
        If ReportFileStatus(FileName) = 1 Then
            Set f = fso.Getfile(FileName)
            GetFileSize = f.Size
        Else
            GetFileSize = -1
        End if
    End Function
   
    '檔案刪除
    Function DeleteAFile(filespec)
    '//功能:檔案刪除
    '//形參:檔案名稱
    '//傳回值:成功為1,失敗為-1
    '//
        If ReportFileStatus(filespec) = 1 Then
              fso.DeleteFile(filespec)
            DeleteAFile = 1
        Else
            DeleteAFile = -1
&nbs



相關文章

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

Starter Package

SSD Cloud server and data transfer for only $2.50 a month

Get Started >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。