Skip to content

Instantly share code, notes, and snippets.

@singularitti
Created August 10, 2022 21:36
Show Gist options
  • Save singularitti/7a9f52befafb3733154d08836f151fe0 to your computer and use it in GitHub Desktop.
Save singularitti/7a9f52befafb3733154d08836f151fe0 to your computer and use it in GitHub Desktop.
Delete local time machine backups #macOS #backup
using IOCapture
c = IOCapture.capture() do
run(`tmutil listlocalsnapshots /`)
end
const REGEX = r"com\.apple\.TimeMachine\.(\d+-\d+-\d+-\d+)\.local"
map(split(c.output, "\n", keepempty=false)) do line
m = match(REGEX, line)
if m !== nothing
version = m[1]
try
run(`tmutil deletelocalsnapshots $version`)
catch e
e
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment