5
I have a function to read the files in the folder, and it’s not working. I need a functional function that reads files from folders and subfolders. Follows the code:
FolderBrowserDialog fbd = new FolderBrowserDialog();
DialogResult result = fbd.ShowDialog();
txtArquivo.Text = fbd.SelectedPath.ToString();
//Marca o diretório a ser listado
DirectoryInfo diretorio = new DirectoryInfo(txtArquivo.Text);
//Executa função GetFile(Lista os arquivos desejados de acordo com o parametro)
FileInfo[] Arquivos = diretorio.GetFiles("*.xml; *xlsx;");
string[] files = System.IO.Directory.GetFiles(fbd.SelectedPath);
You used
diretorio.GetFiles("*.xml; *xlsx;");
. This way of using one more search pattern is not documented and in the tests I did, it was not possible to take the data of the two extensions, on the contrary, using the two separate patterns with;
brings back nothing.– Maniero
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero