Created
July 19, 2017 06:20
-
-
Save jreisinger/e7869300bffa17d806f42dcc2bb92bb8 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
#!/usr/bin/env python3 | |
import sys, os, subprocess | |
if len(sys.argv) != 2: | |
raise SystemExit("Usage: {} USB_MOUNT_POINT".format(sys.argv[0])) | |
usb_mount_point = sys.argv[1] | |
home = os.path.expanduser("~") | |
files = ( | |
os.path.join(home, 'Desktop', 'data'), | |
os.path.join(home, 'Desktop', 'data2') | |
) | |
for f in files: | |
cmd = [ "rsync", "-az", f, usb_mount_point ] | |
print(" ".join(cmd), "...", end="") | |
try: | |
subprocess.check_output(cmd, stderr=subprocess.STDOUT) | |
except subprocess.CalledProcessError as e: | |
print(" FAIL") | |
else: | |
print(" OK") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment