Michel,
GetFiles has on overload with one argument. From the docs:
Returns a file list from the current directory matching the given searchPattern, such as "*.txt".
public FileInfo[] GetFiles(string);
You should be able to replace your for each line with this:
For Each loFile In loDirectory.GetFiles("*.html")
Einar
>I have a temporary directory that content some .html files. When the form is closed, I would like to delete all of them. So far, I have this:
>
>
> Dim loDirectory As New DirectoryInfo(Mid(lcTemp, 1, Len(lcTemp) - 1))
> Dim loFile As FileInfo
> For Each loFile In loDirectory.GetFiles()
> Framework.DeleteFile(lcTemp + loFile.Name)
> Next
>
>
>But, this is removing all files. While I can check for the extension before deleting the file, I would like to For Each loop to only loop for .html files. Is there a way to have the loDirectory to be initialized for a specific extension only?
Semper ubi sub ubi.