From 2cc73684566d3621131587ee758adc9caec3e209 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Thu, 31 May 2018 19:12:55 +0800 Subject: [PATCH] Hide ephemeral files from Time Machine --- empw | 1 + hsync | 2 ++ 2 files changed, 3 insertions(+) diff --git a/empw b/empw index 1fa6f46..b5e6c98 100755 --- a/empw +++ b/empw @@ -216,6 +216,7 @@ hsyncback = path.join(scriptfolder, 'hsyncback') if not path.exists(bootimg): print('Creating new scratch boot disk.') copyfile(backupimg, bootimg) + run(['xattr', '-w', 'com.apple.metadata:com_apple_backup_excludeItem', 'com.apple.backupd', bootimg]) diff --git a/hsync b/hsync index b733ac5..da9a62b 100755 --- a/hsync +++ b/hsync @@ -48,6 +48,8 @@ label = 'Src' # Dirs are in /full/path/without/trailing/slash form, thanks to os.path.abspath if not path.exists(srcimg): + run(['touch', srcimg]) + run(['xattr', '-w', 'com.apple.metadata:com_apple_backup_excludeItem', 'com.apple.backupd', srcimg]) run(['dd', 'if=/dev/zero', 'of='+srcimg, 'bs=1048576', 'count='+str(256)], stdout=DEVNULL, stderr=DEVNULL, check=True) run(['hformat', '-l', label, srcimg], stdout=DEVNULL, check=True) run(['humount'], check=True)