tuning
This commit is contained in:
parent
6beb47d953
commit
7da840f13a
@ -8,31 +8,37 @@ import pathlib
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import pprint
|
import pprint
|
||||||
import msvcrt
|
import msvcrt
|
||||||
|
verbose = True
|
||||||
|
|
||||||
root = Path('.').resolve().parent.parent
|
root = Path('.').resolve().parent.parent
|
||||||
boxdir = root / "Box Sync" / "TIJ4-ebook-Backups"
|
boxdir = root / "Box Sync" / "TIJ4-ebook-Backups"
|
||||||
gdrive = root / "Google Drive" / "TIJ4RefreshedBackups"
|
gdrive = root / "Google Drive" / "TIJ4RefreshedBackups"
|
||||||
idrive = root / "IDrive-Sync" / "TIJ4-ebook-Backups"
|
idrive = root / "IDrive-Sync" / "TIJ4-ebook-Backups"
|
||||||
|
|
||||||
def cp(src, dest, display=True):
|
def cp(src, dest, display=True, shortForm=False):
|
||||||
if type(src) is pathlib.WindowsPath:
|
if type(src) is pathlib.WindowsPath:
|
||||||
name = src.name
|
name = src.name
|
||||||
else:
|
else:
|
||||||
name = src
|
name = src
|
||||||
if display:
|
if display:
|
||||||
print("copying", name)
|
if shortForm:
|
||||||
print("to:", dest, "\n")
|
print(name)
|
||||||
|
else:
|
||||||
|
print("\ncopying", name)
|
||||||
|
print("to:", dest)
|
||||||
shutil.copy(str(src), str(dest))
|
shutil.copy(str(src), str(dest))
|
||||||
|
|
||||||
now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M")
|
now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M")
|
||||||
zip_file_name = 'TIJDirectorsCut-' + now + '.zip'
|
zip_file_name = 'TIJDirectorsCut-' + now + '.zip'
|
||||||
dest = boxdir / zip_file_name
|
dest = boxdir / zip_file_name
|
||||||
print(dest, "\n")
|
print(dest)
|
||||||
tozip = ["Notes.txt", "backup.bat", "go.bat"] + glob("*.py") + glob("*.docx") + glob("*.docm")
|
tozip = ["Notes.txt", "backup.bat", "go.bat"] + glob("*.py") + glob("*.docx") + glob("*.docm")
|
||||||
|
|
||||||
with zipfile.ZipFile(str(dest), 'w') as myzip:
|
with zipfile.ZipFile(str(dest), 'w') as myzip:
|
||||||
for f in tozip:
|
for f in tozip:
|
||||||
myzip.write(f)
|
myzip.write(f)
|
||||||
|
if verbose:
|
||||||
|
print("adding {}".format(f))
|
||||||
|
|
||||||
cp(dest, gdrive)
|
cp(dest, gdrive)
|
||||||
cp(dest, idrive)
|
cp(dest, idrive)
|
||||||
@ -41,9 +47,9 @@ shortcut = Path(r"C:\Python34\Scripts")
|
|||||||
tools = ["Examples.py", "Validate.py", "backup.bat", "go.bat", "StripLastBlankLine.py",
|
tools = ["Examples.py", "Validate.py", "backup.bat", "go.bat", "StripLastBlankLine.py",
|
||||||
shortcut / "v.bat", shortcut / "e.bat"]
|
shortcut / "v.bat", shortcut / "e.bat"]
|
||||||
|
|
||||||
print("copying tools to Github")
|
print("\nCopying tools to Github")
|
||||||
for tool in tools:
|
for tool in tools:
|
||||||
cp(tool, root / "Documents" / "GitHub" / "TIJ-Directors-Cut" / "tools", False)
|
cp(tool, root / "Documents" / "GitHub" / "TIJ-Directors-Cut" / "tools", shortForm=True)
|
||||||
|
|
||||||
# Touch this file to indicate most recent update time:
|
# Touch this file to indicate most recent update time:
|
||||||
os.utime("backup.bat", None)
|
os.utime("backup.bat", None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user