This is a command line application to manage and fine-tune Time Machine exclude paths.
This is a command line application to manage and fine-tune Time Machine exclude paths.
brew tap tg44/heptapod
brew install heptapod
To print help;
heptapod -h
heptapod <action> -h
Move (and use) the default ruleset;
mkdir -p ~/.heptapod/rules
cp -R $(brew --prefix heptapod)/rules ~/.heptapod
Lists all the rules (you get 4 tables, enabled, disabled, parseable but unrunable and unparsable).
heptapod rules ls -a
Enable/disable rules (by name), or add/remove ignore folders;
heptapod rules disable node bower
heptapod rules enable bower
heptapod rules ignoreAdd ~/.Trash ~/.yarn/cache ~/Library
heptapod rules ignoreRemove ~/.Trash
List all the currently excluded TM paths;
heptapod tm ls
Dryrun the current rules, in verbose mode, also log speed and debug informations. (Potentially list nonexistent directories and files!)
heptapod -v 1 run -d
To run the current rules, and add the dirs to the TM exclude list. Also writes exclude logs to ~/.heptapod/logs
(or the given --logDir dir
) for easier revert.
heptapod run
To revert all the previously added paths from the run-exclude-logs. (prune -h
could tell you the other useful revert options).
heptapod prune -a
When you try to migrate your TM state to a new machine
xcode-select --install
may be needed. Somehow this is
sometimes not migrating as you thought it will.
There are two ways to exclude a dir from backups;
tmutil addexclusion -p
)
defaults read /Library/Preferences/com.apple.TimeMachine.plist SkipPaths
tmutil addexclusion
)
mdfind com_apple_backup_excludeItem = 'com.apple.backupd'
is a close call, but some folders are excluded by mdfind too)This tool excludes by flag! You can check any folder manually with tmutil isexcluded
. If you delete a folder, it will be deleted with its flag. You don't need to clean up ever.
Also, you can only exclude nonexcluded files with tmutil, so we only add them if they are exists and if they are not already added.
Every rule has a searchPaths, ignorePaths.
name
for categorizationenabled
for easier enable/disablesearchPaths
are the root of the rule search like ~
ignorePaths
are subpaths that we want to ignore to make the run quicker
~
, but not ~/Downloads
type
is the ruletype
file-trigger
regexp
ignore-file
global
list
settings
other type setting see belowParses the .gitignore
or .dockerignore
files, and excludes its contents.
forceIncludePaths
are files that we add even if they would be otherwise excluded
.gitignore
ignores .env
files but we forcefully want to add them backfileName
.gitignore
or .dockerignore
Ignores all files/folders with the given regexp. This can be slow!
regexp
Ignores files/dirs based on other files existence, made for easy language dep ignores.
fileTrigger
like package.json
or .git
excludePaths
like node-modules
or .
Globally ignores or excludes path (overrides other rules walk ignores).
path
the global path we want to evaluate (like ~/.npm
)handleWith
a string enum
ignore
- ignores globallyexclude
- ignores globally and excludes from backupsCan group multiple rules to a single file.
subRules
the array of subRules (can be recursive with another list
)Notes;
rules ls
works, enable
, disable
and the path commands not working for the subrules, you need to edit the file manuallysearchPaths
and ignorePaths
are currently do nothing
If you are interested in this repo, star it, and write an issue, and we can talk about future ideas there!
done:
todos:
.
and ..
will break the execution shortcuts and need to fix them*.sh
not working right now, do we want to make them work?