No result in this post , I would like to know how it would be used the Directory.GetFiles
function, to list the files and folders within it without showing the full path.
Ex:
public List Listar(String a){
return Directory.GetFiles(a, "* .*").ToList();
}
static void Main(string[] args){
var lista = Listar(@"C:\Windows\Inf");
foreach(string a in lista){
Console.WriteLine(a);
}
Console.ReadLine();
Console.Exit();
}
In this context you should return instead of C: \ Windows \ Inf \ .inf would only return the file: \ .inf file the same would be with the folders.
Ex: There is a folder with the name of files0 it would return instead of C: \ Windows \ Inf \ files0 \ strong>
OBS: I was told the following: Run:
var arquivos = Directory.EnumerateFiles("C:\Windows\Inf", "*",
SearchOption.AllDirectories).Select(Path.GetFileName);
But I want to run this code and Visual C # 2008/2010 says that the reference:
Directory.EnumerateFiles
does not exist because I only use version 4.0 of the Microsoft .NET Framework