Exception has been thrown by the target of an invocation. ---> System.IO.IOException: Cannot create a file when that file already exists.
-Check if the file already exists in the directory using below approaches :
- string path = @ "c:\temp\MySample.txt";
- bool exists=File.Exists(path))
- Use Path Exists activity and use Path Type as File
- Provide the file path as per the directory
- Output will be the bool exists variable
Use "If" activity in UiPath and pass the "exists" variable in it to verify.
-If the file name already exists then rename file during creating or moving it and that should fix the issue