Topic: Backup
Hi All,
On 7/4/20 jean.brezhonek was kind enough to provide the following procedure to create a backup file of my database file.
-
procedure MenuClick1 (Sender: string);
begin
CopyFile('sqlite.db', 'backup/backup '+ FormatDateTime('dd-mm-yyyy hh-nn-ss', now)+'.db');
end;
-
I created a Backup Folder in my project folder as he suggested. This routine works great. It copies my data file along with the current date and time.
-
However, this is what I would like to do and here's why. Each time the user signs out of my program it creates a new backup file. I'm thinking that over time there will be lots of backup files in my folder. Assume l'm using he program once every day, that's about 30 backups per month. Because this procedure will be automatic, the user will not see these files unless they knew where to look.
-
What I did was to remove the date and time from the procedure. This works fine. However it creates and overwrites the old file. This is also OK by me since it will be the latest backup file. However Date Modified always shows the same date and time. In my case
9/5/2020 1:39 pm.
-
I would like have it show the date and time that the file was actually backed up. I noticed a PreserveTime: setting for the CopyFile command. I don't really know, but I'm guessing this setting might use the actual date and time? However I can't get it to work. I'm a total novice using Pascal so I'm sure that's most of my problem.
-
Any thoughts will be appreciated.
Thanks, Frank