I try to copy some files around, and sometimes the lengths of the names exceed the length that the System.IO.File.Copy method can take (260 characters depending on the exception that the throw gets)
According to the research I did, I should use the win32 api file methods in combination with \? \ Preended to paths to get a limit of 32,000 characters, but I'm not sure if the witch methods I need to import.
Can someone help me? I am looking for something like (obviously, another function, but you understand):
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
static extern SafeFileHandle CreateFileW(string lpFileName, uint dwDesiredAccess,
uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition,
uint dwFlagsAndAttributes, IntPtr hTemplateFile);
source
share