Skip to content

Instantly share code, notes, and snippets.

@SuoXC
SuoXC / recursive_unzip.py
Created December 6, 2019 04:16
use zipfile to unzip a zipfile recursively to target directory
import os
import zipfile
def recursive_unzip(zip_file, target_dir):
print("export: ", zip_file)
if not os.path.exists(target_dir):
os.makedirs(target_dir)
@SuoXC
SuoXC / safe_backup.py
Created August 20, 2020 11:49
rsync sometimes delete files with no backup, so this script is a solution to safely sync things
import filecmp
import os
import pathlib
import shutil
def no_change(src_file, dest_file):
equal = filecmp.cmp(src_file.resolve(), dest_file.resolve(), False)
return equal