Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
CopyFile return $Failed when the file exists on destination.
is there any way to force CopyFile to overwrite the existing one?
the way I use now is DeleteFile and then CopyFile
Use the OverwriteTarget -> True option. Alas, this is not specified in the documentation.
OverwriteTarget -> True
gives, among other details,
CopyFile[ "foo1.txt", "foo2.txt", OverwriteTarget -> True ]
does the trick for me.
Required, but never shown