[2005] Not getting all files in a directory properly...
Code:
Dim FileList As New List(Of String)
''The IO.SearchOptions.AllDirectories Flag tells it to search all subdirectories as well
''Set the search pattern to *.* telling it get all files
FileList.AddRange(IO.Directory.GetFiles(Directories.KCPath, "*.*", IO.SearchOption.AllDirectories))
ReDim LockFiles(FileList.Count - 1)
For i As Integer = 0 To FileList.Count() - 1
LockFiles(i) = New FileStream(FileList(i), FileMode.Open)
Next i
FileList.Clear()
I have a directory like this:
Code:
CompanyName
File "somefile1"
File "somefile2"
File "somefile3"
Folder1
File 1
Folder 2
File 1
Folder 3
File 1
The only files that become 'locked' or 'protected' from deletion are 'somefile1, 2, and 3'
The files in the folders can be deleted...
Does anyone know why it is not detecting them?
Thanks
Re: [2005] Not getting all files in a directory properly...
I have fixed it, I had that in a try catch statement, and it was creating an error on one file which already was locked by a separate filestream, which I have fixed now...
Thanks for all your help everyone (lolz.. no posts:D)