Hello,
I'm making an application to locate a file in a directory and save it to the database, as well as save tbm to the PATH. But I need to save only the name of the directories it finds, without being the complete directory.
For example: The files are by default always in the folder C: \ FILES \ {0} \ {1} \ {2}
I need to get only the name of the folders described in {0}, {1}, {2}.
I was able to do this, but just taking the entire path:
static void BuscaRecursivaDiretorios(string caminho)
{
DirectoryInfo objDir = new DirectoryInfo(caminho);
foreach (DirectoryInfo objSubDir in objDir.GetDirectories())
{
BuscaRecursivaDiretorios(objSubDir.FullName);
}
foreach (FileInfo objFile in objDir.GetFiles())
{
Console.WriteLine(objFile.FullName);
}
}