La tecnica permette di cercare i file con quelle due estensioni anche nelle sottocartelle.
VB.Net
Imports System.IO
Dim files = Directory.EnumerateFiles("C:\Users\cartella\Downloads", "*.*", SearchOption.AllDirectories).Where(Function(s) s.EndsWith(".exe") OrElse s.EndsWith(".pdf"))
Dim files = Directory.EnumerateFiles("C:\Users\cartella\Downloads", "*.*", SearchOption.AllDirectories).Where(Function(s) s.EndsWith(".exe") OrElse s.EndsWith(".pdf"))
C#
using System.IO;
var files = Directory.EnumerateFiles(@"C:\Users\cartella\Downloads", "*.*", SearchOption.AllDirectories)
.Where(s => s.EndsWith(".exe") || s.EndsWith(".pdf"));
.Where(s => s.EndsWith(".exe") || s.EndsWith(".pdf"));
Nessun commento:
Posta un commento