I have this line of code that copies a file from one directory to another:
File.copy(Path.Combine(sourceDir, fileName), Path.Combine(destinationDir, fileName), true);
When I step through the code, all variables have the correct values and the full filename, but when I go view the file in the destination directory ( destinationDir
) the file is there with only part of the original file name...
The original file name is New Employee Orientation - Benefits
and when it is copied over to the new destination is it New Employee Orientation - Benefi
I have another file that is similarly named and it cuts off at the same amount of characters (including white spaces).
Is File.copy
your own function or a typo? Should be File.Copy
if using .NET's Copy function. If it's your own, need to see and walkthrough that code still.
Otherwise, character limit is 260 and a likely culprit. Move the Path.Combine(string,string)
outside of File.copy
and check the value and length. See Naming Files, Paths and Namespaces for more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.