Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this

DirectoryInfo di = new DirectoryInfo(@"C:\Users\Yusuf\Desktop\excel\x");
Dosyalar = di.GetFiles("*.csv");


I want it detect directoryinfo automaticaly
My program is run inside excel folder

I used this command
DirectoryInfo di = new DirectoryInfo(Application.StartupPath);
Dosyalar = di.GetFiles("*.csv");

Its showing me files inside the excel folder but I want to see files inside excel\x

how can I see that?

What I have tried:

DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));


DirectoryInfo di = new DirectoryInfo(Directory.GetCurrentDirectory());
Posted
Updated 18-May-22 23:28pm

1 solution

You can use:

String path = Path.Combine(Application.StartupPath, "x");
DirectoryInfo di = new DirectoryInfo(path);
 
Share this answer
 
Comments
YusufA0 19-May-22 5:29am    
Thanks it worked
Ahmad_kelany 19-May-22 5:33am    
You're welcome

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