Skip to content

A simple script that compresses files/folders and moves them to a backup location

License

Notifications You must be signed in to change notification settings

hmerritt/backup-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backup.sh

Build Status

A simple script that compresses files/folders and moves them to a backup location

Getting Started

Install Dependencies

Install script dependencies via install argument.

$ sudo ./backup.sh install

Bash on Windows

Thanks to WSL, you can run bash scripts on windows!

Config file

Create config

In order to add backups, you need to create a separate config file.

$ ./backup.sh setup

Load config

You can load the config file by adding its path after backup: backup <path-to-config>

$ ./backup.sh <path-to-config>

You can have as many config files as you like (this could be used to run different backups)

Usage

$ ./backup.sh <path-to-config>

Add files/folders to backup

  • Open the config file (backup-config.sh) and find the ENTER FOLDERS TO BACKUP HERE text
  • Add a file/folder by following the syntax guide below
# ENTER FOLDERS TO BACKUP HERE
##############################
# backup "name-of-folder" "/directory-of-parent-folder/" "/directory-of-parent-backup-folder/"
# backup "profile-images" "/my/images/" "/my/backup/google-drive/images/"

backup "name of file/folder" "full path to folder" "full path to backup location"


# Lets try a more real example

# We are backing up a folder called "music" that exists in our "documents" folder
# This is then packaged up and moved to the "backup" directory

backup "music" "/home/user/documents/" "/home/user/backup/documents/"

# Original     "/home/user/documents/music/"
# Backed-up                            "/home/user/backup/documents/music.tar.gz"