取得文件名的简单办法

string fullPath = @"D:\KwDownload\song\test.mp3";

string filename = System.IO.Path.GetFileName(fullPath);//文件名  “test.mp3”

string extension = System.IO.Path.GetExtension(fullPath);//扩展名 “.mp3”

string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(fullPath);// 没有扩展名的文件名 “test”

原文地址:https://www.cnblogs.com/wubin264/p/1433718.html