一、pb8自带的函数 filecopy(sourcefile,targetfile {,isReplace})
默认:isReplace=false
if isReplace then if fileExists(targetfile) then targetfile被改写 else targetfile被创建 end if
else if fileExists(targetfile) then 报错 -1 Error opening sourcefile else targetfile被创建 end if
end if
二、windows api FUNCTION boolean FileCopy(ref string sourcefile, ref string targetfile , boolean isFailIfExists) LIBRARY "Kernel32.dll" alias for "CopyFileA"
if isFailIfExists then if fileExists(targetfile) then return FALSE //!!! else targetfile被创建 end if
else if fileExists(targetfile) then targetfile被改写 else targetfile被创建 end if
end if