我想获得第二个到最后一级的目录树,我用数组来获取。 当它到达Console.WriteLine部分时,它不显示任何内容,它似乎跳过整行。第二个到目录树的最后一个层次
foreach (string file in files)
{
string thepathoflife = Path.GetFullPath(file);
string filetocopy = file;
string location = file;
bool b = false;
string extension = Path.GetExtension(file);
string thenameofdoom = Path.GetFileNameWithoutExtension(file);
string filename = Path.GetFileName(file);
//here is my attempt
string dirthing = Path.GetDirectoryName(filename); //here is my attempt
System.Console.WriteLine("" + dirthing); //here is my attempt
我会尝试这个 – shred1894
我要查找的文件所在的文件夹,我使用的System.Console.WriteLine(“” + dirthing);看看它是否有效。 – shred1894
这是有效的,它只花了我一秒钟的时间来弄清楚所有的东西都不让它显示出来,这是一个小错字,并没有导致异常 – shred1894