Code Backup Utility is a simple Power Automate script designed to back up your projects to your favorite location.
Code Backup Utility is designed for people who would like to create "snapshots" of the projects they're working on. Code Backup Utility is also very useful in cases where, if the source files are corrupted, you can restore from a backup location and be back to a working state.
Code Backup Utility includes the following features:
- Copy the files to a backup location
- Delete temporary Git and Visual Studio directories in the target directory
These features will be added to Code Backup Utility:
- Support for deleting more temporary directories
NOTE: this procedure is a bit complex and lengthy, as Power Automate doesn't support exporting scripts
-
Begin by downloading and installing Power Automate Desktop
If you have Windows 11, this tool is already included
-
Launch Power Automate. # if the program asks to do so
-
Create a new flow by clicking "New flow" on the menu
- Open the
code-backup-util.robin
script file and copy all its contents to the editor. Power Automate will interpret everything and put it in a nice view
- IMPORTANT: replace all values of
SourceFolder
fromC:\dev
(a sample development folder) with the folder you store the projects on. Also replace all references ofI:\
with the target directory of your choosing - Save the new flow and click the Play button in the flow list
Power Automate doesn't support scheduling desktop flows, so we have to improvise a little bit with Task Scheduler:
- Open Task Scheduler or press
Win + R
and typetaskschd.msc
- Right-click an empty area of the task list, and click "New basic task..."
- Provide a name and a description (the latter is optional)
- Specify when should the task be triggered. It is recommended to keep the default value, and to trigger the task at 9 PM
If your time zone is affected by daylight savings, tick the "Sync time zones" check box
-
Tell the wizard to start a program (it is the default value), and specify the following settings in the next page:
- Program or script:
ping
- Arguments:
localhost
- Start in: (nothing)
- Program or script:
The flow waits for the
ping
process. The combination doesn't ping external servers, but only your host system (localhost
,127.0.0.1
)
- In the Summary screen, click "Finish"
The disadvantage of this is that, when the task is triggered, a CMD window will show. This is the ping
command running. If you know of a better way of running the task without showing anything, please let me know.
You'll need to follow the steps in the "How do I begin?" section first. Then, make your fixes, select ALL blocks and copy it to a text editor. Save the contents to code-backup-util.robin
and replace the contents of the old file in the repository. That's it!