How to Create Your Own Free File Backup Utility with LibertyBASIC
By popular demand we are bringing you this tutorial on how to create a simple but effective free file backup utility with LibertyBASIC, a Windows programming tool. In an earlier article, we showed you a simple algorithm for creating your own free desktop file backup utility. Well, today we’re taking it a step further by actually creating the program for you.
This will be a step-by-step tutorial with fully-coded examples. Our program is called SimpleBackupTool and it was developed entirely with LibertyBASIC, a Windows programming utility. to familiarize yourself with LibertyBASIC or to download the compiler (free trial available for Windows) visit the LibertyBASIC website.
We picked LibertyBASIC because it’s a simple language anybody can learn quickly. Ok let’s get started.
Introducing SimpleBackupTool
SimpleBackupTool is based on the same algorithm we showed you in our earlier article. It’s a basic desktop file backup program capable of:
- Multiple file copy per backup (up to 20x supported)
- Multi-folder backup (first layer only)
- Real-time notifications (Busy/Idle “LED” indicator, status messages)
With SimpleBackupTool, you can backup all files within target folders (but not folders within folders) up to 20 times for as much redundancy as you’d prefer. Feel free to tweak up the code as we go along to maybe add additional functionality or program features. But it’s pretty useful as it is.
Now, let’s take a look inside: The first step in developing any program is to draw up an algorithm that shows how the parts work together to realize the functions of the program. Here’s how it works, again:
So, as we mentioned in our earlier article, we have five components in SimpleBackupTool: the backup registry, backup sentry (controller), copy agent (backup agent), user input, and report manager.
Backup Registry
The Backup Registry is a simple TXT file that contains the list of folders to be backed up. All files in the folders listed here will be backed up (but not folders in these folders). So keep all your data in single-layer folders where possible when using SimpleBackupTool.
The picture above shows two folders in the registry to be backed up: “C:\test1\” and “C:\test2\”.
You update this file with new backup targets as required. Also note that all files are backed up to the same folder – which is named automatically by date, such as “”Backup-Nov 27, 2013” as shown in the picture above.
User Input
For this version of SimpleBackupTool, user input is limited to copy depth (the number of times you want to backup each file). This is selected using the copy depth selector (shown in the first image).
Other examples of user input for more complex implementations may include:
- Dynamic backup locations
- Automatic backup scheduling
- Encryption keys, passwords
- Compression options
- Archiving options
Report Manager
The Report Manager is meant to handle real-time updates. For this version of SimpleBackupTool, it consists of the busy/idle “LED” indicator and the real-time status prompter (shown in the first image).
Backup Sentry (Controller)
The Backup Sentry is the logic that controls the entire application. In this case, it is hidden behind the GUI (Graphic User Interface) implementation.
This is the guy that does all the hard work backing up the files. You can’t see him because he’s a real underdog working behind the scenes. With SimpleBackupTool, multiple backups of files are prefixed with a number such as 1-sample.txt, 2-sample.txt and so on.
8 Screenshots: SimpleBackupTool in Action
OK let’s see some screenshots of SimpleBackupTool in action.
Now that you know it works, let’s do a code walkthrough so you can see how it works, and maybe add your own modifications.
Code Walkthrough: SimpleBackupTool
Remember, this code is entirely in LibertyBASIC. You may want to brush up on your LibertyBASIC before you continue – it’s easy, use the lessons and example programs on the website or compiler to get started!
Click this link for the SimpleBackupTool full source code. You will need it to continue.
The 4-part walkthrough below explains key segments of the code. You can also paste the code in your compiler and RUN the program to use SimpleBackupTool!
Part I: Initial Settings
This is the initial part of the program that creates the registry and backup folder, and listens for events.
Let’s see part two – how to load the registry.
Part II: Loading the Registry
This part of the code loads the registry list into the program’s memory so the locations on that list can be accessed for backup in real-time.
Part III: Backing Up
This part of the walkthrough looks at how the backup is actually done in a loop process. We isolate the number of target folders (recall this data has already been saved to memory).
A batch process (looping configuration) is then used to sequentially access the folders and extract a list of files in those folders to be fed into the actual copy process, which replicates them according to the selected copy depth.
Part IV: Program GUI (Graphical User Interface)
Finally, we’re going to take a look at the code that generated the GUI for SimpleBackupTool.
The code controls the window properties for the GUI, including height, width and position. It also sets properties for the objects on the window, such as the buttons, static text objects, graphic box (“LED”) , and combo box (copy depth selector).
Object properties set include position, size, and event handlers (where the program goes when they are clicked or set). The event handlers link to a “branch label” like [loadRegistry] which contains a list of actions to be performed when the event is initiated.
The code finally names the window – in this case “Simple Backup Tool” and launches it, setting display options and listening for events at the same time.
Conclusion
Hi there! We hope you’ve enjoyed reading this post and learned a lot. Here’s a roundup of what we covered: we have looked at how to create simple backup tools with LibertyBASIC, a Windows programming utility.
We analyzed SimpleBackupTool, a simple and free desktop backup program using a segment-by-segment 4-part code walkthrough. We offered you the full SimpleBackupTool source code to compile on your own and use or modify as desired
For questions about SimpleBackupTool specifically, please send an email to [email protected]. If you would like to respond to this post, send us a comment! We’d love to hear from you.