Reputation: 783
I am reading files from directory and adding it to the tree. I want to know the each file's full path, and get the date modified. When i use GetFullPath it gives me path like : C:\Windows\SysWOW64\inetsrv\old.mp4 which is not actually the path of the file.
System.IO.FileInfo[] Files = directory.GetFiles();
for (int FileCount = 0; FileCount < Files.Length; FileCount++)
{
**lblTest.Text = lblTest.Text +"<br>"+ Path.GetFullPath(Files[FileCount].ToString());**
DirNode.ChildNodes.Add(new TreeNode(Files[FileCount].Name));
}
Can anyone help me doing this? Thanks in advance.
Upvotes: 1
Views: 79
Reputation: 101681
Use FileInfo.FullName
property.
Gets the full path of the directory or file.
lblTest.Text += Files[FileCount].FullName;
Upvotes: 3