我有這個代碼來獲取文件夾及其子目錄中的所有文件。獲取文件的根路徑
FolderBrowserDialog fb = new FolderBrowserDialog();
if (fb.ShowDialog() == DialogResult.OK)
{
foreach (string folder in System.IO.Directory.GetFiles(fb.SelectedPath, "*.*", System.IO.SearchOption.AllDirectories))
listBox1.Items.Add(Path.GetFullPath(folder));
}
但它返回這樣的文件路徑: C:\用戶\隨機\桌面\ TheSelectedFolder \ SubFolder1 \ Subfolder2 \ file.txt的 我怎樣才能使它返回選定的唯一名稱文件夾加上子目錄的路徑?沒有盤符,用戶名等
我要檢索選定文件夾的唯一名稱+它的路徑的子文件夾沒有**「C:\用戶\隨機\桌面\ ** – Adrao 2013-05-09 04:54:32