我想刪除名稱和包含文件夾的文件; 當我說的名字我的意思是沒有擴展名。通過名稱獲取文件擴展名
這是我知道的方式。 (對你有一點幫助,它會作品)
//the extension string doesn't work properly.Here I need your help
string extension = Path.GetExtension(@"C:\Projects_2012\Project_Noam\Files\ProteinPic" + comboBox1.SelectedItem.ToString());
string fileLoc = @"C:\Projects_2012\Project_Noam\Files\ProteinPic\" + comboBox1.SelectedItem.ToString() + extension;
if (File.Exists(fileLoc))
{
File.Delete(fileLoc);
}
什麼時候是多個文件具有相同的名稱和不同的擴展名? –
@Radu,你爲什麼不編輯SO用戶的格式? – Gabe
@TimSchmelter我不給它是具有相同名稱的文件 – Noam650