string path =@"D:/111/123.txt";
System.IO.Path.ChangeExtension(filePath, "txt") | 更改路径字符串的扩展名 | D:/111/123.txt |
System.IO.Path.GetDirectoryName(filePath) | 返回指定路径字符串的目录信息 | D:/111 |
System.IO.Path.GetExtension(filePath) | 返回指定的路径字符串的扩展名 | .txt |
System.IO.Path.GetFileName(filePath) | 返回指定路径字符串的文件名和扩展名 | 123.txt |
System.IO.Path.GetFileNameWithoutExtension(filePath) | 返回不具有扩展名的指定路径字符串的文件名 | 123 |
System.IO.Path.GetPathRoot(filePath) | 获取指定路径的根目录信息 | D:/ |
System.IO.Path.GetRandomFileName() | 返回随机文件夹名或文件名 | cfdsdsh.sed |
System.IO.Path.GetTempFileName() | 创建唯一命名的零字节的临时文件并返回其绝对路径 | C:/Documents and Settings/Administrator/Local Settings/Temp/tmp01.tmp |
System.IO.Path.GetTempPath() | 返回当前系统的临时文件夹的路径 | C:/Documents and Settings/Administrator/Local Settings/Temp/ |
System.IO.Path.HasExtension(filePath) | 返回路径是否包括文件扩展名 | Ture |
System.IO.Path.IsPathRooted(filePath) | 返回路径是绝对路径还是相对路径 | Ture |
System.IO.Path.Combine(@ "d: ", "1.txt ") | 返回合并后的路径 | d:/1.txt |
System.IO.Path.GetFullPath("123.txt") | 查找文件并返回其绝对路径 | D:/111/123.txt |