c# – Could not find a part of the path error message

c# – Could not find a part of the path error message

The error is self explanatory. The path you are trying to access is not present.

string source_dir = E:\Debug\VipBat\{0};

Im sure that this is not the correct path. Debug folder directly in E: drive looks wrong to me. I guess there must be the project name folder directory present.

Second thing; what is {0} in your string. I am sure that it is an argument placeholder because folder name cannot contains {0} such name. So you need to use String.Format() to replace the actual value.

string source_dir = String.Format(E:\Debug\VipBat\{0},variableName);

But first check the path existence that you are trying to access.

Theres something wrong. You have written:

string source_dir = @E:\Debug\VipBat\{0};

and the error was

Could not find a part of the path EDebugVCCSBat

This is not the same directory.

In your code theres a problem, you have to use:

string source_dir = @E:DebugVipBat; // remove {0} and the \ if using @

or

string source_dir = E:\Debug\VipBat; // remove {0} and the @ if using \

c# – Could not find a part of the path error message

Is the drive E a mapped drive? Then, it can be created by another account other than the user account. This may be the cause of the error.

Leave a Reply

Your email address will not be published.