Function Reference


_FO_FileBackup

Creates a backup copy of the file.

#Include <FileOperations.au3>
_FO_FileBackup ( $sPathOriginal [, $sPathBackup='' [, $iCountCopies=3 [, $iDiffSize=0 [, $iDiffTime=0]]]] )

Parameters

$sPathOriginal The full path to the original file
$sPathBackup [optional] The full or relative path to the directory for the backup. By default, the "", the empty string, i.e. the current folder
$iCountCopies [optional] The maximum number of copies from 1 or more. By default, 3 copies.
$iDiffSize [optional] Consider changing the size.
    -1 - forced to make a backup copy of the
    0 - do not take into account the size (by default). In this case, specify the parameter $iDiffTime
    1 - the backup is created, if the original is different from the latest copy by size
$iDiffTime [optional] The length of time in seconds between changes of the original and the latest copy of the file. Default 0 - do not check.

Return Value

Success:Returns 1, indicates that the backup copy is created
Failure:Returns 0 and sets @error:
@error:0 - no error, but not necessarily creating a backup, if there are no criteria
1 - could not create the backup, FileMove or DirMove failure
2 - the number of copies specified less than 1
3 - missing file for backup

Remarks

The function creates a new backup, while the oldest copy is deleted and the intermediate are renamed with the shift of the index. In the absence of criteria (the default), only one copy is created and updated in the future.

Example

; AZJIO
; http://www.autoitscript.com/forum/topic/133224-filesearch-foldersearch/
#include <Array.au3> ; для _ArrayDisplay
#include <FileOperations.au3>

$Success = _FO_FileBackup(@ScriptDir & '\file.au3', 'Backup', 3, -1)
MsgBox(0, 'Backup is successful', 'Success = ' & $Success & @CRLF & '@error = ' & @error)