Created
February 2, 2015 14:08
-
-
Save hirokazumiyaji/c1f00a3d43d96db1c9c7 to your computer and use it in GitHub Desktop.
rsync
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 python | |
# coding: utf-8 | |
from __future__ import absolute_import, unicode_literals, print_function | |
import commands | |
import sys | |
COMMAND = "rsync -arv {EXCLUDE} --partial {FROM} {TO}" | |
EXCLUDES = [] | |
if __name__ == "__main__": | |
argv = sys.argv[1:] | |
from_file, to_file = argv[0], argv[1] | |
excludes = " ".join(["--exclude='{}'".format(exclude) for exclude in EXCLUDES]) | |
status, output = commands.getstatusoutput( | |
COMMAND.format(EXCLUDE=excludes, FROM=from_file, TO=to_file)) | |
print(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment