beaconlightboy
asked on
vb.net FileInfo not listing correctly
I wrote some code that simple cleans out a users temporary internet cache, however it does not want to list out on the console all the files in the directory. However if i change the directory to non hidden directory it works fine. any ideas? obviously username is in place of a username i would type in during testing.
My.Application.DoEvents()
Dim DSPath As String = "C:\Documents and settings\username\local settings\temporary internet files"
'Dim DSPath As String = "C:\Documents and Settings\" & GetUsername(My.User.Name) & "\Local Settings\Temporary Internet Files"
Dim DS As New System.IO.DirectoryInfo(DSPath)
Dim FI As System.IO.FileInfo
Console.WriteLine(FIA.Length)
For Each FI In DS.GetFiles
Me.TBStatus.Text = "Cleaning Cookies: " & FI.FullName
Console.WriteLine(FI.FullName)
Next
ASKER
Ok but i don't want to delete the directory, and that doesn't explain why the code doesn't show the directory listing when i select that directory as opposed to others.
The code will not delete the root directory. Use directory.getfiles(path) to show the contents, the way u are doing it filters out hidden objects
ASKER
huh, nice of them to tell you that in the documentation. i will try it.
Cool
Cool
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window