c# 文件操作
时间:2020-04-27 16:40:32
收藏:0
阅读:47
string path=“”;//文件的绝对路径
1. 获取文件所在的目录 Path.GetDirectoryName(path)
2.获取文件 的文件名称(不包含后缀名) Path.GetFileNameWithoutExtension(path)
3.获取文件 的文件名称(包含后缀名) Path.GetFileName(path)
4.获取文件 的文件的后缀名 Path.GetExtension(path)
5. 将修改文件名
if (System.IO.File.Exists(path))
{
System.IO.File.Move(path, endUrl);//原文件名 目标文件名
}
原文:https://www.cnblogs.com/lwycaoyu/p/12787645.html
评论(0)