Deleted files visible to Directory.GetFiles???

PaulZ

Active member
Joined
Apr 8, 2004
Messages
26
Location
Dordrecht, the Netherlands
SITUATION:
I deleted all files from C:\MyDir.
When my program starts it has to empty the MyDir directory if there are any files left. This is done by this code:
-- Start code ---
Dim dirs As String() = Directory.GetFiles("C:\MyDir\", "*")
Dim dirsAtl As Integer = dirs.Length
If dirsAtl > 0 Then
Get Filename
Delete the file in directory
End If
-- End code ---
At the start of the program, I manually emptied MyDir, but suprisingly, my program still wants to delete the files (filenames do match exactly!) I just manually deleted. This raises an error (no permission to these files).
QUESTION:
I know how to handle this error, but I want to know how it is possible that Directory.GetFiles("C:\MyDir\", "*") can return any files in an empty directory...

Anyone an idea?

Thanx,
Paul
 
Last edited by a moderator:
Certainly that sounds strange. Maybe they are just being hidden. Can you locate any of these files from the Windows Explorer with hidden files being visible? Do you see anything on the Command Prompt when you use Dir? Can you open any of the files in Notepad? How did you get the filename and delete the file?
 
Back
Top