我想刪除根目錄下的所有文件夾e:\ trichy.root文件夾也包含子文件夾,如e:\ trichy \ chn \ 20008 \ 20204 * .mp3文件。請幫助我 。總是出現錯誤。關於使用vb.net的子文件夾下的文件夾
Dim rootfolder1 As FileInfo
rootfolder1 = txtRootFolder.Text
Try
If Directory.Exists(rootfolder1) Then
Dim files() As String = Directory.GetDirectories(rootfolder1)
For Each file As String In files
Dim fi As FileInfo = New FileInfo(file)
If (fi.LastAccessTime < DateTime.Now.AddMonths(-3)) Then
fi.Delete()
display_status("files are deleted successfully")
End If
Next
End If
Catch ex As Exception
display_status("Error in file deletion" & ex.Message)
End Try
請幫我刪除這個根文件夾下的子文件夾下的文件?
你歌廳什麼錯誤? – FosterZ 2012-03-06 11:55:18
你爲什麼不發佈錯誤細節?我們應該猜測嗎? – Oded 2012-03-06 11:55:43