Skip to content

A simple Power Automate script that copies code files to a backup directory

License

Notifications You must be signed in to change notification settings

CodingWonders/code-backup-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Code Backup Utility

Code Backup Utility is a simple Power Automate script designed to back up your projects to your favorite location.

Who is this script designed for?

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.

Features of Code Backup Utility

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

What will be added?

These features will be added to Code Backup Utility:

  • Support for deleting more temporary directories

How do I begin?

NOTE: this procedure is a bit complex and lengthy, as Power Automate doesn't support exporting scripts

  1. Begin by downloading and installing Power Automate Desktop

    If you have Windows 11, this tool is already included

  2. Launch Power Automate. # if the program asks to do so

  3. Create a new flow by clicking "New flow" on the menu

3. Give it a new name, or continue without naming it

4. You'll enter the Power Automate editor

  1. 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

  1. IMPORTANT: replace all values of SourceFolder from C:\dev (a sample development folder) with the folder you store the projects on. Also replace all references of I:\ with the target directory of your choosing
  2. Save the new flow and click the Play button in the flow list

Scheduling the task

Power Automate doesn't support scheduling desktop flows, so we have to improvise a little bit with Task Scheduler:

  1. Open Task Scheduler or press Win + R and type taskschd.msc

  1. Right-click an empty area of the task list, and click "New basic task..."

  1. Provide a name and a description (the latter is optional)

  1. 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

  1. 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)

The flow waits for the ping process. The combination doesn't ping external servers, but only your host system (localhost, 127.0.0.1)

  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.

How do I contribute?

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!

About

A simple Power Automate script that copies code files to a backup directory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published