Last active
August 29, 2015 14:11
-
-
Save Echocage/571e9b6c524b2698aa69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import argparse | |
| import sys | |
| from sh import rsync | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("BACKUPDIR", help="Specify the directory to backup.") | |
| parser.add_argument("DESTINATIONDIR", help="Specify the directory where the backup is stored.") | |
| args = parser.parse_args() | |
| # Define variables | |
| backupdir = args.BACKUPDIR | |
| destinationdir = args.DESTINATIONDIR | |
| exclude_list = '/Users/lpuljic/scripts/python/my_rsync/EXCLUDE_rsync' | |
| ## Check if BACKUP directory exist | |
| def check_backupdir_exist(backup_dir, destination_dir): | |
| if not os.path.exists(backup_dir): | |
| print "Backup directory doesn't exist" | |
| exit(1) | |
| else: | |
| if not os.path.exists(destination_dir): | |
| print "Destination directory oesn't exist" | |
| exit(1) | |
| else: | |
| print "\nBackup directory %s exists" %backup_dir | |
| print "Desitantion directory %s exists\n" %destination_dir | |
| check_backupdir_exist(backupdir, destinationdir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment