Reputation: 65
This is the code:
FileInfo[] flist = d.GetFiles();
if (flist.GetLength(0) > 0)
{
foreach (FileInfo txf in flist)
{
string fn = txf.FullName + txf.Extension;
}
}
If i'm doing only fullname it will give me the directory+file name but without the Extension. And if i'm doing it: string fn = txf.FullName + txf.Extension; Extension is empty ""
I need to get it full like this for exmaple: c:\test.png Or that fn will contain: c:\temp\dir\testing.jpg
Full directory path + full file name + the file name extension
Upvotes: 2
Views: 8135
Reputation: 13523
According to the documentation, FullName
field of a FileInfo
object includes full path, file name and file extension (FileInfo
inherits FullName
from FileSystemInfo
). So it is more like the code, which is in charge for creating these files, is not appending the proper extension (Assuming d
is a DirectoryInfo
and not other - maybe homemade - class).
Upvotes: 4