When using Path.Combine
, you are not supposed to add leading or trailing backslashes (\\
). Leading backslash is an instruction to discard all path info and start from the root, and produces @"\files\file.csv"
.
This works:
string path = Path.Combine (dirLoc, "files\\file.csv");
Or this (for better cross platform support):
string path = Path.Combine (dirLoc, "files", "file.csv");