Archive: Best way to do a backup file


Best way to do a backup file
Hello

Before processing a file I want to do a backup of it.
I think about copyfiles

copyfiles myfile myfile.bak

It is the best way ?

Thanks a lot


i'd add an iffileexist dialog and a messagebox which would ask the user, if he wants to overwrite a previous backup file.


Hello Yathosho and thanks with reply

But how do you do the backup of the file before processing?

Thanks


CopyFiles?

CreateDirectory "$INSTDIR\Backup"

SetOutPath $INSTDIR

IfFileExists "$INSTDIR\file.ext" 0 +2
CopyFiles "$INSTDIR\file.ext" "$INSTDIR\Backup\file.ext"

File "file.ext"
File "..."

RMDir "$INSTDIR\Backup" ; remove backup dir if empty


-Stu

Thanks