How to program backup software

By , last updated January 24, 2016

In this article I will show you how to make your own backup software without downloading any tools. There is a lot of free and paid software for backup that you can use. One of them is Immortal files for both Windows and Mac. But if you don’t want to use any of it, here is how you can do it yourself.

Backup is an extra copy of your files and systems. It’s always best to store your backup externally. This will minimize your risk of losing everything if something happens to your computer. But sometimes it’s more convenient to store things locally as well. Internal storage can be beneficial if you are making a lot of small changes and it won’t hurt you much losing it. There are many ways to make a local copy of your files: copy and paste everything manually, using a backup and restore functionality in Windows, local repositories like SVN, GIT or Mercurial and many others.


Latest versions of Windows come with great tools to take your backups. An example is “Backup and Restore” utility where you set everything up by clicking some buttons. Next I will talk about how to make it yourself.

Command line

The easiest way to backup your files in Windows is by making a local backup executable .bat file and using a command robocopy (or xcopy for Windows XP). Robocopy command is a standard feature in Windows starting from Windows Vista.

Read also  Templates on the surface

ROBOCOPY Source_folder Destination_folder [files_to_copy] [options]

  1. Open Notepad
  2. Next we will copy all subfolders (/e) from myfiles to disk D and Show Estimated Time (/eta). Type in the backup command:
    @echo off
    robocopy c:myfiles d: /e /eta
  3. Save file as .bat (for example backup.bat)
  4. Double-click on the file to run
  5. Automatic backup

    There are a lot of things to remember to do these days. So you will need to set up your backups to run automatically. After you have created a backup.bat file you need to set it up to run automatically. There are several ways to do it:

    • Backup on startup.
      Right-click on your .bat file and select “Create Shortcut.” After you have created the shortcut, move it to a Startup folder and your hard drive will get automatically backed up every time you log in.

      This is an easy way to do it if you start your system often. I don’t shut it down for several months in a row, so this method is not suitable for everybody.

    • Schedule with Windows Task Scheduler.
      Open Windows Task Scheduler and click “Add Scheduled Task”. On the “Click the program you want Windows to run” selection screen, click “Browse…” and choose your .bat file. Choose the frequency you for your task to run. Now your scheduled task will execute itself automatically at the day and time you chose. You can always create several identical tasks to perform the backup more frequently.


    Linux is a very powerful system. It’s built to make things mostly with commands. This is also the most reliable way to take your system backups.


    On Unix systems the easiest command line is rsync.

    rsync option source-directory destination-directory

    Here is a simple example that will create a directory “mydata” inside “mybackup” and copy everything there:

    rsync -vax /hdd1/mydata /hdd1/mybackup

    A good thing about external hard drives is that you mount them into your system. The following example command with rsync for Linux will create the directory “mydata” on the second hard drive and copy it to the destination:

    rsync -vax /hdd1/mydata /hdd2/

    Automatic backup

    System snapshots

    Somewhat complex, but very good option is to use the btrfs filesystem with snapshots on Linux.

    System snapshot is a copy of your system at the time the snapshot is taken. It’s similar to system images in Windows.

    Here is an in-depth article about BTRFS.

    Cron jobs

    In order to backup your file automatically in Linux you will need to set up a cron job. In Linux it’s easy to do it with crontab. Crontab is a command that created a cron table file that contains commands and instructions for the cron daemon to execute. Depending on your Linux installation, you may need to get a crontab on your system.

    syntax of crontab command:
    minute(s) hour(s) day(s) month(s) weekday(s) command(s)

    Here is an example of making a backup every day at 23:30. Command with these options will also delete files that you have deleted from mydata:

    30 23 * * * rsync -vax --delete /hdd1/mydata /hdd2/

    Example execute a cron job (WordPress wp-cron.php ) every 10 minutes:

    */10 * * * * /usr/bin/php -f ~/webroot/crontab.php

    Crontab.php is a file we wrote in order to call WordPress wp-cron when we want. Per default WordPress wp-cron runs each time a user visits your website.

    Read more: How to disable WordPress WP-cron with Crontab.

    You should store your data somewhere in addition to your primary system. It can be a Cloud storage, external servers, hard drives under your table or another PC/tablet/phone. No matter what you choose – make at least one external backup.

    This rule can be summarized as the 321-rule. Keep at least 3 copies, in two different formats and 1 of those copies off site.


    Be the first to comment.

    Leave a Reply

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>