3

I have found some questions here asking the same thing, however the answers have not worked for me. I have a path to another machine on the network where I store files in the following format;

\\machinename\share

We have paths longer than 260 characters. It does not allow me to save these paths when I use this code;

    private static void CreateDirectories(string totalPath)
    {
        var file = new FileInfo(totalPath);

        if (file.Directory != null && !file.Directory.Exists)
            file.Directory.Create();
    }

I have tried using the following notations in the 'totalPath' parameter which don't work if I try to navigate to them in file explorer;

\\?\machinename\share
\\?\UNC\machinename\share

Am I using these paths correctly? Neither of these manage to navigate to the share in file explorer. Is there any other way I can save a file with a path that is longer than 260 characters using C# on windows?

Thanks for any pointers.

creatiive
  • 1,073
  • 21
  • 49

0 Answers0