In C# console app I am trying to copy images from one dir to another and then copy the original image from original location to a processed location. I have tried Thread.Sleep etc. but with no luck. Please help!
File.Copy(sourcePath, destinationPath ,true);
File.Move(sourcePath, processedPath);
All paths are like c:\dir\subdir\image1.png
but different subdir locations.
I get the following error
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.IOException: The process cannot access the file because it is being used by another process.