Answer the question
In order to leave comments, you need to log in
System.IO.DirectoryNotFoundException: Part of the path could not be found. What to do?
for (int z = 2; z <= 15; z++)
{
File.Copy(@"C:\Users\ZeNoX\source\repos\sus\sus\Resources\peele.jpg", [email protected]"C:\Users\{Environment.UserName}\Desktop\sus({z}).jpg");
}
Answer the question
In order to leave comments, you need to log in
You put the image in the properties so that it is always copied to the target folder during the build.
And then you do this:
var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var targetPath = Path.Combine(desktop, "sus(42).jpg");
File.Copy(@"./Resources/peele.jpg", targetPath);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question