[Windows] Copy File -with Flags for Overwrite

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Windows] Copy File -with Flags for Overwrite

Post by BackupUser »

Restored from previous forum. Originally posted by wayne1.

Code updated for 5.20+

Code: Select all

; PB WINDOWS VERSION 
; COPYS FILE TO ANOTHER LOCATION BUT WILL NOT OVERWRITE IF THE FLAG IS SET
; Specifies how this operation is to proceed if a file of the same name 
; as that specified by lpNewFileName already exists.
; If this parameter is TRUE And the new file already exists, the function fails.
; If this parameter is FALSE And the new file already exists, the function overwrites the existing file And succeeds. 
; If the function succeeds, the return value is nonzero.
; If the function fails, the return value is zero.

Result = CopyFile_("C:\A\test2.x","C:\A\Test\test2.x",1 )
;Set to 1 it won't overwrite, set 0 to overwrite
Edited by - wayne1 on 09 July 2001 00:22:53