I'm trying to get the full path to a file.
I have the "end" of the path like:
\some_folder\myTextFile.txt
and the "beginning" like:
c:\Users\me\...
how do I find the absolute path to the textfile?
I'm trying to get the full path to a file.
I have the "end" of the path like:
\some_folder\myTextFile.txt
and the "beginning" like:
c:\Users\me\...
how do I find the absolute path to the textfile?
using System.IO
(...)
string relativePath = "\some_folder\myTextFile.txt";
string absolutePath = Path.GetFullPath(relativePath);
should work
string [] fileEntries = Directory.GetFiles(targetDirectory);
foreach(string a in fileEntries)
{
if(a.Contains("\some_folder\myTextFile.tx"))
{
return a
}
else
{
continue;
}
}