Click here to Skip to main content
15,913,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Get all pdf files path folders and subfolders in d drive

like D:\ex.pdf
D:\folder\ex.pdf
D:\folder\folder1\ex.pdf
Posted

use this code get all files from directory.

C#
string[] filePaths = Directory.GetFiles(@"c:\MyDir\", "*.pdf",
                                         SearchOption.AllDirectories);



more about http://msdn.microsoft.com/en-us/library/07wt70x2(v=vs.110).aspx[^]
 
Share this answer
 
Comments
vr reddy 2-Sep-14 4:35am    
i added above line but below exception raised how to avoid

D:\$RECYCLE.BIN\S-1-5-21-2058226654-3769073445-1446610972-3079\
vr reddy 2-Sep-14 4:35am    
i added above line but below exception raised how to avoid
Access to the path 'D:\$RECYCLE.BIN\S-1-5-21-2058226654-3769073445-1446610972-3079\' is denied
vangapally Naveen Kumar 2-Sep-14 4:40am    
error says that directory access is denied to you change folder properties and security give the full control.
vr reddy 2-Sep-14 4:42am    
But above path is system defined path that is not my pdf files, i want only retrive my pdfs
vangapally Naveen Kumar 2-Sep-14 4:48am    
Run your code as an administrator on the machine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900