Skip to content

Instantly share code, notes, and snippets.

@aoirint
Created May 19, 2018 12:43
Show Gist options
  • Save aoirint/ef541284491d7000ea6b613086e51182 to your computer and use it in GitHub Desktop.
Save aoirint/ef541284491d7000ea6b613086e51182 to your computer and use it in GitHub Desktop.
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