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.
Use FileInfo.FullName
property.
Gets the full path of the directory or file.
lblTest.Text += Files[FileCount].FullName;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.