C# Directory.CreateDirectory建立多层文件夹目录 路径长度过长问题

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace addDirectory
{
class Program
{
static void Main(string[] args)
{

        string activeDir = @"D:\myDir";
        if (Directory.Exists(activeDir))//如果不存在就创建file文件夹{MessageBox.Show("存在文件夹");
        //Directory.Delete(aaaa, false);//如果文件夹中有文件或目录,此处会报错
        {
           // MessageBox.Show("已存在同名文件夹 是否重新创建?(Y or N)");
            Console.WriteLine("已存在同名文件夹 是否重新创建?(Y or N)");
            string scan = Console.ReadLine();
            if (scan == "Y" || scan == "y")
                Directory.Delete(activeDir, true);

        }//true代表删除文件夹及其里面的子目录和文件}
        else
        {
            Console.WriteLine("不存在此文件夹 正在创建");
        }
        System.IO.Directory.CreateDirectory(activeDir);
        string newPath = activeDir;
        for (int i = 0; i < 20; i++)
            {
                //newPath = System.IO.Path.Combine(newPath, "\\" + "dir" + i);
                newPath += "\\" + "dir" + i;
                Console.WriteLine(newPath);
                try
                {
                    Directory.CreateDirectory(newPath);
                }
                catch (System.UnauthorizedAccessException e) { System.Console.WriteLine(e.Message); }
              //  string fileNameOne = DateTime.Now.ToString("yyyyMMddHHmmssffff")
          //  + ".txt";
              //  string filePathOne = System.IO.Path.Combine(newPath, fileNameOne);
              //  System.IO.File.Create(filePathOne);
            }
        }
    }
}

循环200次路径太长 没法建立该文件夹 有其他处理办法吗?因为后面要处理遍历目录并输出文件夹名和路径到XML

这个是操作系统问题,不是程序问题吧!

程序没问题,但是按这种思路没法完成目标。有没有其他思路可以绕过这个限制来创建文件夹的?

fat32文件系统可以通过先创建文件夹,再移动的办法绕过限制,但是ntfs就不行。