Created
August 23, 2015 19:38
-
-
Save carterjones/81703ce8b35be4ece636 to your computer and use it in GitHub Desktop.
script to back up the game saves directory for Uplink (http://store.steampowered.com/app/1510/)
This file contains 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 errno | |
import datetime | |
import os | |
import shutil | |
# Ripped from http://stackoverflow.com/a/1994840 | |
def copyanything(src, dst): | |
try: | |
shutil.copytree(src, dst) | |
except OSError as exc: # python >2.5 | |
if exc.errno == errno.ENOTDIR: | |
shutil.copy(src, dst) | |
else: raise | |
# Make a timestamp-labeled backup of the "users" directory. | |
def make_backup(): | |
timenow = str(datetime.datetime.utcnow()) | |
timeformatted = timenow.replace(' ', '-').replace(':', '-') | |
copyanything('users', 'users-backup-' + timeformatted) | |
# Save this file to the steam\SteamApps\common\Uplink directory and run it. | |
if __name__ == '__main__': | |
make_backup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment