Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想重命名同一文件夹中的文件,我该如何实现?
现在我正在使用
File.Move(Server.MapPath(p.FilePath), Server.MapPath("~/Programs/test/Outputs/" + UserID + "/") + ID +".pdf");
是的,有一个解决方案,你可以试试Path.GetDirectoryName
Path.GetDirectoryName
File.Move(Server.MapPath(p.FilePath), Server.MapPath(Path.GetDirectoryName(Server.MapPath(p.FilePath)))+"\\" "filename");