попробуйте не WinApi, а NET
X++:
boolean ret = true;
FolderPath pathFrom, pathTo;
FileName fullFileName;
System.Exception clrException;
;
pathFrom = this.getImportPath();
fullFileName = pathFrom + "\\" + _fileName;
if (!System.IO.File::Exists(fullFileName))
{
warning("Не найден файл " + fullFileName);
return false;
}
pathTo = this.getImportPathLocal();
if (System.IO.File::Exists(pathTo + _fileName))
{
System.IO.File::Delete(pathTo + _fileName);
}
try
{
System.IO.File::Move(fullFileName, pathTo + _fileName);
}
catch (Exception::CLRError)
{
ret = false;
clrException = CLRInterop::getLastException();
if (clrException)
{
clrException = clrException.get_InnerException();
if (clrException)
{
error(clrException.get_Message());
}
}
}