In ubuntu I've created a share. On windows I mounted this share to Y using:
mount -o nolock \\192.168.2.44/mnt/shared Y:
Next, I want to use a dotnet core application to create directories in this share. This application should support any character supported by the NFS share folder.
static void Main(string[] args)
{
// works if Y: is NFS
Directory.CreateDirectory("Y:/subdir/:"); // works!
Directory.CreateDirectory("Y:/:"); // works!
// Directory.CreateDirectory("Y:/**"); // Does not work
// Directory.CreateDirectory("Y:/?"); // Does not work
try
{
Directory.CreateDirectory("C:/:"); // NTFS
} catch (Exception e)
{
Console.WriteLine("Not NFS"); // ntfs does not work (as expected)
}
}
The above code works as expected; if I want to create a directory ":" the program allows this on the NFS share but not on the NTFS drive.
I expect this to behave the same for directories ** and ?. But if I comment out these lines of code I get an error.
Anyone knows how I can create special-character dictionaries in dotnet core 2.2?
Things I've already tried
I tried to use the unicode of questionmark
Directory.CreateDirectory("Y:/\u003F");
But this results in the same error.
This question is NOT the same as What characters are forbidden in Windows and Linux directory names? because: The above question asks what the forbidden characters are in windows and linux file directories. My question is about how to get around those windows restrictions when you want to write to a linux directory from windows.