timemachine-exclude
v1.0.1
Published
A CLI tool to manage Time Machine exclusions
Readme
timemachine-exclude
A CLI tool to manage Time Machine exclusions for node_modules and other specified directories. This tool helps you prevent backing up unnecessary large directories, improving the efficiency of Time Machine backups.
Installation
npm install -g timemachine-excludeUsage
timemachine-exclude <command> [options]Commands
init: Initializestimemachine-excludewith parent directories to search in and patterns to exclude. This will create a config file in~/.tm_exclude_config.populate: Finds directories that match your exclude patterns (e.g.,node_modules,dist,build) within your specified parent directories and updates the list of exclusions. This will create an exclusions file in~/.tm_exclusions_tm_exclude.apply: Applies the discovered exclusions to Time Machine.update: Executespopulatefollowed byapplyto update exclusions.list: Lists the current Time Machine exclusions in the exclusion file.help: Displays the help message.
Examples
Initialize the tool
timemachine-exclude initThis command prompts you to enter parent directories to search for exclusions, followed by the exclusion patterns. For example:
Initializing timemachine-exclude...
Enter parent directories to search in.
Enter each directory path followed by [ENTER]. When done, enter an empty line.
Directory: ~/Projects
Directory: ~/Workspace
Directory:
Enter directory names or patterns to exclude.
Enter each pattern followed by [ENTER]. When done, enter an empty line.
Example patterns: node_modules, dist, build, *.cache
Pattern: node_modules
Pattern: dist
Pattern: build
Pattern:
Configuration saved to /Users/yourusername/.tm_exclude_configPopulate exclusions
timemachine-exclude populateThis command scans the specified parent directories for directories matching the exclusion patterns, then creates a list of full paths in ~/.tm_exclusions_tm_exclude
Populating exclusions...
Searching in: /Users/yourusername/Projects
Excluded: /Users/yourusername/Projects/myproject/node_modules
Searching in: /Users/yourusername/Workspace
Excluded: /Users/yourusername/Workspace/anotherproject/node_modules
Excluded: /Users/yourusername/Workspace/anotherproject/dist
All excluded directories have been listed in /Users/yourusername/.tm_exclusions_tm_excludeApply exclusions to Time Machine
timemachine-exclude applyThis command reads the contents of ~/.tm_exclusions_tm_exclude and applies each path to the Time Machine exclusion list.
Applying exclusions to Time Machine...
Added exclusion: /Users/yourusername/Projects/myproject/node_modules
Added exclusion: /Users/yourusername/Workspace/anotherproject/node_modules
Added exclusion: /Users/yourusername/Workspace/anotherproject/dist
All exclusions have been applied to Time Machine.Update exclusions
timemachine-exclude updateThis command runs the populate command to find new exclusions and applies them to Time Machine
List exclusions
timemachine-exclude listThis command outputs the contents of ~/.tm_exclusions_tm_exclude.
Listing current Time Machine exclusions for node_modules:
/Users/yourusername/Projects/myproject/node_modules
/Users/yourusername/Workspace/anotherproject/node_modules
/Users/yourusername/Workspace/anotherproject/distConfiguration
The tool uses two configuration files in your home directory:
~/.tm_exclude_config: Stores the parent directories to search and exclude patterns, as defined when you run theinitcommand.~/.tm_exclusions_tm_exclude: Stores the generated list of directories to be excluded from Time Machine backups. This is generated by thepopulatecommand.
How it Works
- Initialization:
- The
initcommand allows users to define parent directories for searching and patterns of directories to exclude from the backup. This information is stored in~/.tm_exclude_config.
- The
- Populating Exclusions:
- The
populatecommand reads configuration details from~/.tm_exclude_configand searches all specified directories for the patterns provided. Matching directories are listed in~/.tm_exclusions_tm_exclude.
- The
- Applying Exclusions:
- The
applycommand reads the exclusion paths from~/.tm_exclusions_tm_excludeand uses thetmutilcommand to add them as exclusions in Time Machine.
- The
- Updating Exclusions:
- The
updatecommand combines thepopulateandapplyactions, refreshing the list of exclusions based on the current file system and applying those changes to Time Machine.
- The
- Listing Exclusions:
- The
listcommand displays the currently excluded directories in~/.tm_exclusions_tm_exclude.
- The
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
