【发布时间】:2015-02-08 15:44:23
【问题描述】:
我设法找到了一种从我可以访问的网站下载 .txt 文件的方法,这很棒,但我使用的是我添加到 datagridview 的文件名列表。
我的下一步是从网站的根目录和子目录下载任何 .txt 文件,但如果它存在于我的下载位置 c:\logs 中,它将跳过它。
感激地接受任何指示。 VBVirg
【问题讨论】:
标签: vb.net download file-exists
我设法找到了一种从我可以访问的网站下载 .txt 文件的方法,这很棒,但我使用的是我添加到 datagridview 的文件名列表。
我的下一步是从网站的根目录和子目录下载任何 .txt 文件,但如果它存在于我的下载位置 c:\logs 中,它将跳过它。
感激地接受任何指示。 VBVirg
【问题讨论】:
标签: vb.net download file-exists
除了文森特的回答:
Dim FilePath As String = "YourFile"
If My.Computer.FileSystem.FileExists(FilePath) = True Then
'File exists, delete it
My.Computer.FileSystem.DeleteFile(FilePath)
Else
'The file doesn't exist.
End If
【讨论】:
Dim _FilePath As String = "<file path and name here>"
If My.Computer.FileSystem.FileExist(_FilePath) = True Then
'File exists.
End If
【讨论】: