PaulZ
Active member
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
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: