以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎样用命令清空指定文件夹里的所有文件?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=67281)

--  作者:zgjmost
--  发布时间:2015/4/21 17:49:00
--  怎样用命令清空指定文件夹里的所有文件?
怎样用命令清空指定文件夹里的所有文件?
--  作者:pcxjxjhkw
--  发布时间:2015/4/21 18:26:00
--  
方法一:
Dim path As String = "d:\\1"
If FileSys.DirectoryExists(path) = True Then
    For Each str As String In FileSys.GetFiles(path)
        FileSys.DeleteFile(str)
    Next
End If

方法二:
Dim path As String = "d:\\1"
If FileSys.DirectoryExists(path) = True Then
    FileSys.DeleteDirectory(path,2,2)
    FileSys.CreateDirectory(path)
End If