Komitet
Komitet
CC#
Created by Komitet on 6/26/2024 in #help
I want to find file when the file it's found I want to say where is the file path
I created this code and nothing:
List<string> fileNameToFind = new List<string>()
{
"d3d10.dll",
"d3d10(1).dll"
};

string informacoesEncontradas = "";
string username = Environment.UserName;
string allPath = Path.GetFullPath(@"C:\\");

try
{
if (Directory.Exists(allPath))
{
informacoesEncontradas += $"Files found at {allPath}\n";

string[] foundFilesAll = Directory.GetFiles(allPath, "*", SearchOption.AllDirectories);

if (foundFilesAll.Length > 0)
{
foreach (string filePath in foundFilesAll)
{
foreach (string fileName in fileNameToFind)
{
if (Path.GetFileName(filePath) == fileName)
{
informacoesEncontradas += filePath + "\n";
}
}
}
informacoesEncontradas = "EXP -> " + informacoesEncontradas;
}
}
}
catch (Exception ex)
{
// Handle the exception
}
List<string> fileNameToFind = new List<string>()
{
"d3d10.dll",
"d3d10(1).dll"
};

string informacoesEncontradas = "";
string username = Environment.UserName;
string allPath = Path.GetFullPath(@"C:\\");

try
{
if (Directory.Exists(allPath))
{
informacoesEncontradas += $"Files found at {allPath}\n";

string[] foundFilesAll = Directory.GetFiles(allPath, "*", SearchOption.AllDirectories);

if (foundFilesAll.Length > 0)
{
foreach (string filePath in foundFilesAll)
{
foreach (string fileName in fileNameToFind)
{
if (Path.GetFileName(filePath) == fileName)
{
informacoesEncontradas += filePath + "\n";
}
}
}
informacoesEncontradas = "EXP -> " + informacoesEncontradas;
}
}
}
catch (Exception ex)
{
// Handle the exception
}
12 replies