Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing only .html files
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00974212
Message ID:
00974220
Vues:
26
This message has been marked as the solution to the initial question of the thread.
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform