Pre nego što kreneš u kreiranje direktorijuma, proveri da li su svi karakteri u imenu dozvoljeni:
Code:
/// <summary>
/// Function for filtering out not allowed characters in name for a Path
/// </summary>
/// <param name="inputName">Name to process</param>
/// <returns>Name which can be used for path (file / folder)</returns>
public static string GetNameForPath(string inputName)
{
foreach(char ch in Path.GetInvalidFileNameChars())
{
inputName = inputName.Replace(ch, '_');
}
foreach(char ch in Path.GetInvalidPathChars())
{
inputName = inputName.Replace(ch, '_');
}
return inputName;
}