-1
Hello,
I’m making an application to locate a file in a directory and save it to the bank as well as save tbm to the PATH. But I need to save only the name of the directories that it is, without being the complete directory.
For example: Files are by default always in the C folder: FILES {0} {1} {2}
I need to take only the name of the folders described in {0}, {1}, {2}.
I managed to do this, but just taking the whole 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);
}
}
One way would be what has already been answered in https://answall.com/q/35400/101. It may be that what helps you most is: https://answall.com/q/208381/101. You may not want to separate everything and only take one specific one as in https://en.stackoverflow.com/q/243891/101.
– Maniero
The examples were not clear to me. But anyway thank you.
– Lucas