Created
May 19, 2018 12:43
-
-
Save aoirint/ef541284491d7000ea6b613086e51182 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 platform | |
import subprocess | |
#src = | |
#dest = | |
#logfile = | |
def utcnow(): | |
from datetime import datetime as dt | |
from datetime import timezone as tz | |
return dt.now(tz=tz.utc) | |
system, node = platform.uname()[:2] | |
now = utcnow() | |
print(system, node) | |
print(now) | |
with open(logfile, 'a', encoding='utf-8') as fp: | |
fp.write('%s,%s\n' % (node, now.isoformat())) | |
if system == 'Windows': | |
cmd = [ 'robocopy', src, dest, '/MIR', '/XD', 'System Volume Information', ] | |
subprocess.run(cmd) | |
print() | |
else: | |
print('Unsupported Platform: %s' % system) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment