Directories in c#

Asked

Viewed 140 times

3

I have several. Sql files in this directory: C:\Users\anacarvalho\Desktop\Teste how do I get all these files?

  • You intend to list all scripts within the path?

  • yes is to list, but at the same time run in c#.

  • I created a database, where I put the complete file paths I want. and then in c# I ran and he went to get all those files.But now I want instead of putting all the way in, just type the folder and he goes to get all the files inside that folder

  • I’m still testing! I’ll tell you something

2 answers

3


Use the Method Directory.Getfiles with the option to search in all directories

var Arquivos= Directory.GetFiles(@"C:\Users\anacarvalho ", "*.sql", SearchOption.AllDirectories);

0

For those who want to know how I solved the problem is as follows :

 string path = "C:\Users\anacarvalho\Desktop\Teste"; 
        string[] sqlFilesLocation = Directory.GetFiles(path, "*.sql", SearchOption.AllDirectories);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.