Get List of Files in a Directory

session101

Member
Joined
May 10, 2006
Messages
23
I want to get all the pdf files in all folders under a directory, C:\Temp

How would I do this? This is an ASP.NET app with a C# backend. TIA.
 
System.IO.Directory.GetFiles("c:\temp", "*.pdf")

should do the trick, although permissions may need to be adjusted to allow the web application access to the folder itself.
 
If youre using VB2005 you can use :

[VB]My.Computer.FileSystem.GetDirectories("C:\\Temp",FileIO.SearchOption.SearchAllSubDirectories, "*.pdf")[/VB]
 
Back
Top