C
C#8mo ago
Komitet

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
}
7 Replies
Komitet
KomitetOP8mo ago
any solution?
SleepWellPupper
SleepWellPupper8mo ago
$details
MODiX
MODiX8mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
SleepWellPupper
SleepWellPupper8mo ago
Especially this part:
what you expect the result to be
Komitet
KomitetOP8mo ago
okay, first I want to create fivem scanner to detect cheat in PC and I created it now want to search file in the pc if file exist = send file path my result is show only path C: not path of file
Komitet
KomitetOP8mo ago
No description
Pobiega
Pobiega8mo ago
uh are you scanning the entire harddrive for "d3d10.dll"? that will give you a huge amount of false positives

Did you find this page helpful?