- Home /
File.Move wont work , error. IOException: Win32 IO returned ERROR_ALREADY_EXISTS. Path:
i'm using File.Move to move a text file to Application.dataPath File.Delete works just fine but not File.Move
File.Move(("My File Path of file "),Application.dataPath);
what could be the problem ?
Answer by Guts · Dec 09, 2013 at 06:00 PM
The exception is telling you that the file already exists. From the File.Move doc:
You cannot use the Move method to overwrite an existing file.
You'll have to delete or rename the file if it already exists before you try to move it.
the thing is , it doesn't already exist anywhere but where it was created . I could create a new blank file and write its path in the code and it still wont be moved .
it still returns an error
if (!File.Exists(path))
{
// This statement ensures that the file is created,
// but the handle is not kept.
using (FileStream fs = File.Create(path)) {}
}
if (File.Exists(path2))
{
File.Delete(path2);
}
File.$$anonymous$$ove(path,path2);
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Will System.IO.File work on Macs 2 Answers
How Do I Find Path of a File? 1 Answer
Add files to folder 1 Answer