This article provides an overview of a new feature introduced in PrimalScript 8.1.177 and PowerShell Studio 5.8.219 that enables you to quickly backup your source code.
As mentioned in a previous post about PrimalScript’s new ‘code copy’ feature, when we are requested to retrieve source code from packaged executables it is usually due to a lack of backup or mangling of production code; a lack of backup compounds the latter scenario.
Whenever I ask people why they do not create backups, a common answer is, “It takes too long,” which is often true—my weekly image backup takes 30 minutes to run. Yes, you can use your computer while the backup runs, but it is my observation that most people still just sit and watch paint dry -er- watch the backup finish.
SAPIEN Source Code Backup
The SAPIEN Backup Tool can be located in the PrimalScript Tools Browser or the PowerShell Studio Tools tab on the ribbon. The icon is derived from the famous internet meme “This is fine.” Anyone who has ever irretrievably lost code will get that connection.
PrimalScript – Tools Browser:
PowerShell Studio – Tools tab:
The tool is quite simple: You give a backup task a name, a source folder, a destination folder, and a set of extensions to backup, and off you go.
The tool will create a zip file aptly named by task name and current date. It will keep as many copies as designated and automatically delete older ones; the default is three, but you should adapt that to your needs.
You can create as many tasks as you like, even with overlap. Or, you can have one task that backs up everything. That is entirely up to you.
There is no restore function because the result is a zip file with your original folder structure. If you find yourself needing to restore everything or just a single file, that can easily be done in Windows Explorer.
This tool is meant to backup your source code. Specifically, all of the files you need to rebuild a product: source files, icons, project files, supporting text files, makefiles, resources, etc., but not the finished files or anything that can be rebuilt otherwise. That makes this quick and easy—the almost 4000 files for PrimalScript take less than 20 seconds to process here at SAPIEN Headquarters.
And yes, you could write a PowerShell script to copy folders or files into a date-named zip file. But evidence suggests that many have not done so, which is why we created this.
Schedule Backup Task
You can schedule your backup task to run at a specific time on whichever weekday(s) suit you best. I suggest you run a task once or twice manually and verify all the required files are in the zip before doing this.
You can check all days if you like, but please note that the task will only run if you are logged on to your computer. For simplicity, the task gets scheduled to run as the current user and does not require additional login information.
You can, however, find the scheduled task in the Windows Task Scheduler and modify it as needed:
Last but not least, make sure you provide a good location for your backup. Any place not on your computer will suffice—for example, cloud drive, NAS, external drive etc. If you have an aversion to anything off-site and no additional hardware or the budget for it, most WiFi routers allow you to plug a flash drive into a USB port, thus creating an impromptu network drive. Consider doing that if you have no other means outside of your actual computer.
If you are more of a console jockey and prefer to use the command line, the PrimalScript install folder contains ‘SourceBackup.exe’ which can be used to run the backup files created by this tool from a command line.
The files for each backup task can be found here:
- C:\Users\<User>\AppData\Roaming\SAPIEN\SAPIEN Backup
As always, please feel free to leave feedback or feature requests in the comments below. If the comments are closed, you can always post in our SAPIEN Support Forum.