Dim ext() As String = {".txt", ".XML"}
Dim dinfo As DirectoryInfo = New DirectoryInfo("C:\carpeta")
Dim xfiles() As FileInfo = dinfo.GetFiles.Where(Function(f) ext.Contains(f.Extension.ToLower)).ToArray
Ejemplo1:
Dim files() As String = Directory.GetFiles("C:\carpeta").Where(Function(f) f.EndsWith(".txt")).ToArray
Ejemplo2:
Dim xfiles() As FileInfo = New DirectoryInfo("C:\carpeta").GetFiles.Where(Function(f) Regex.IsMatch(f.Name, "\.(txt|mp3|xml)$")).ToArray
fuente
fuente2
No hay comentarios.:
Publicar un comentario