If I delete and try to move I put the code directly into the trash, it works, but I would try to stay on, because with it, when it finds files in use, skip them without giving errors. In the end I need to try this and to show the files in listview. Finally, it gives me error after start debugging, but take it from me first, that makes me not even start debugging, and tells me that I must first correct the errors. The following is the code now :
Code:
For Each foundFile As String In My.Computer.FileSystem.GetFiles (My.Computer.FileSystem.SpecialDirectories.Temp, _
Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, "*.*")
count = count + 1
Try
info = New System.IO.FileInfo (foundFile, FileIO.UIOption.OnlyErrorLogs, FileIO.RecycleOption.SendToRecycleBin)
sizeTemp = inf.Length
System.IO.File.Delete (foundFile)
size + = sizeTemp
ListBox.Items.Add (foundFile)
Catch exp As Exception
Finally
inf = Nothing
End Try
Next
Here tells me: Overload resolution failed because no 'New' accepts this number of subjects available.
While trying another way :
Code:
For Each foundFile As String In My.Computer.FileSystem.GetFiles (My.Computer.FileSystem.SpecialDirectories.Temp, _
Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, "*.*")
count = count + 1
Try
inf = New System.IO.FileInfo (foundFile)
sizeTemp = info.Length
System.IO.File.Delete (foundFile, FileIO.UIOption.OnlyErrorLogs, FileIO.RecycleOption.SendToRecycleBin)
size + = sizeTemp
ListBox.Items.Add (foundFile)
Catch exp As Exception
Finally
inf = Nothing
End Try
Next
but here I get this: Too many arguments to 'Public Shared Sub Delete (path As String)'.. I'm not understanding anything! I want to integrate the command to move files to the trash directly into this and I do not want to try a different code.
Bookmarks