日期:2014-05-17  浏览次数:21912 次

Illegal characters in path
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;
namespace folderGenerater
{
  class Program
  {
  static void Main(string[] args)
  {
  using (StreamReader sr = new StreamReader("E:\\TDDOWNLOAD\\u6(1).doc"))
  {
  ArrayList al = new ArrayList();

  while (sr.Peek() != -1)
  {
  al.Add(sr.ReadLine());
   
  }
   
  for(int i = 0;i<al.Count;i++)
  {
   
  String para = al[i].ToString();  
  String path = @"D:\\u0926\\"+para ;
   
  if (!System.IO.Directory.Exists(path))
  try
  {
  System.IO.Directory.CreateDirectory(path);
  }
  catch (Exception e) {
  Console.WriteLine(e);
  }
   
  }

  }
  }
  }
}


报错:
System.ArgumentException: Illegal characters in path.
  at System.IO.Path.CheckInvalidPathChars(String path)
  at System.IO.Path.Combine(String path1, String path2)
  at Microsoft.VisualBasic.FileIO.FileSystem.GetFullPathFromNewName(String Path, String NewName, String ArgumentName)
  at Microsoft.VisualBasic.FileIO.FileSystem.RenameFile(String file, String newName)
  at Microsoft.VisualBasic.MyServices.FileSystemProxy.RenameFile(String file, String newName)


谁能帮忙看一下?

------解决方案--------------------
探讨

()不能用在路径中。