Contents of Article


Introduction

Where are they kept?

Managing Backup Files

Requesting a Backup

Requesting a Restore

Backup File Format


Introduction


SPFLite provides a simple to use file Backup and Restore facility. This enables you to easily create multiple date and time stamped backups for your files, on demand, and to restore them simply if and when needed. All without leaving the SPFLite session to run other tools.



Where are they kept?


In order to provide a consistent location, and to prevent 'cluttering up' your normal file storage folders, backup files are stored in a sub-folder of the normal file's location.   SPFLite will create a new folder $BACKUP in the file's normal data folder, and store all backups there.


Note: This means there is not one single $BACKUP folder for your system, it is one $BACKUP folder for each data folder you use for files edited by SPFLite. This simplifies Restore as the destination for the Restore is always the folder above the one which contains the actual Backup file.



Managing Backup Files


SPFLite provides NO support as to managing the Backup files you create.  Everyone has different requirements as to number of backups to retain, how long to retain them etc.  


To assist slightly, SPFLite will, when a BACKUP request is performed, inform you of how many current Backups there are for the file just processed.


You can also, while editing, issue a BACKUP ?  command to query the current number available.


Requesting a Backup


There are several ways to request a new Backup be created.


    1. In File Manager, enter BACKUP | BACK | BK as a line command next to the desired file.
    2. While in Edit / View / Browse of a file, enter BACKUP | BACK | BK on the command line.
    3. Turn AUTOBKUP ON for the profile used by the file.  AUTOBKUP will trigger a Backup for a file:
      • At most ONCE per Edit session.  i.e. a Backup of how the file looked when Edit started.
      • Only if a SAVE is performed (or the file is Saved during END processing)
      • Only for the first SAVE issued. (Variation of the comment in the 1st bullet above)


For ALL cases, a backup will not be created if one already exists for the file and the Last Modified Date & Time stamps are the same.


Note:


If SPFLite detects the presence of an existing backup of the file, with the same Date/Time stamp, it will not create a new backup and will also verify the file size in addition to the date time.


If it rejects the backup and indicates the files are the same size, all is well. (Simply - no Backup is needed)


If it rejects the backup and indicates the files are of different sizes,   This is a problem. It indicates that somehow either the file or the Backup of it were modified somehow outside normal activity.  i.e. If the backup and real file have the same Last Modified date/Time, how can they not have the same file size.   This should be investigated to determine the reason, or, the real file should be examined for validity and if OK, then it should be re-saved, and a new Backup created.


Requesting a Restore


To request a Restore:


    • Use File Manager to browse to the $BACKUP folder located in the same folder of the file that needs to be Restored.
    • Enter RESTORE | REST | RS next to the specific backup you wish to choose to be restored.


When you Browse the $BACKUP folder you will see the Backup files created using the following format for the file name.


testdata.txt.2019-0403-143758-0000006589-0000000434-DD7ACA98.BACKUP



testdata.txt

The original filename


2019-0403-143758

The yyyy-mmdd-hhmmss time-stamp of the file


NOTE: This is the last modified date/time of the original file,

           NOT the date/time the Backup was created.


remaining fields

Reserved for SPFLite use.





Backup File Format


NOTE:  The following information is for reference only, you should never have any need to understand the Backup file format.  All normal access to the files (other than Deleting them when no longer needed) should be done using the BACKUP and RESTORE commands..


We recommend you never directly access or use the Backup files.  Renaming, moving or other modification of the files could render them unusable as Backup files. In fact, since these files are protected with a Hash value, you should NEVER attempt any modification to them, to do so will cause them to be REJECTED by a Restore command.



BUT....  we all know Murphy's Law, so just in case ....


File Format


The format of the Backup file depends on whether a STATE file exists for the file being backed up.  When a file has STATE information, it is important that this information not be "lost" during the Backup / Restore actions.


Files Without STATE data


These could be files for which you have chosen STATE OFF in the Profile, or they could simply be other data files that have never even been opened by SPFLite.


The Backup file is a simple file copy, a clone, the Backup file is identical to the original file.


Files Having STATE data


Since any file having STATE data must have been editable by SPFLite, they are simple text files.  However, to be complete, the associated STATE data must be preserved.


Since STATE files are also simple text files, these files are also created as simple file copies -  except the STATE data is appended to the end of the file.  


SPFLite maintains knowledge of the original data file size so that these two 'pieces' of data can be separated at Restore time into the respective Data and STATE files.  


If you were to examine a Backup file containing STATE information, you would see your original data file text followed by a Header line of:

[[--SPFLite-File-State-Information-//-Do-NOT-Modify--]]


Followed by the actual State data, an example of which would look like:


aaaaaaaaaa aaaaaaaaaa  Fred 13    abcde(abc)+cdef*[def]{ghi}

bbbbbbbbbb bbbbbbbbbb  Fred 14

[[--SPFLite-File-State-Information-//-Do-NOT-Modify--]]

#1C8CAD352,180,1,0,0,0,20,1,1,

#C3/R/1/10/BF9EF40C,4/R/1/10/97318CD2,5/R/1/10/6F83902B,6/R/1/10/56B94302,

#X28/10,

#N0/12/Test Note


Where the BLUE lines are the last couple lines of your real data file, and the RED lines are the State file data.


If for any reason, you cannot use RESTORE and need to recover your Data file from the backup, simply edit the Backup with any text editor, scroll to the bottom and delete the State information from the header line to the end of file. You will have your original data file back.

               

Created with the Personal Edition of HelpNDoc: Generate Kindle eBooks with ease