https://github.com/gpanders/pushbroom
Sweep your filesystem free of clutter
https://github.com/gpanders/pushbroom
python
Last synced: about 2 months ago
JSON representation
Sweep your filesystem free of clutter
- Host: GitHub
- URL: https://github.com/gpanders/pushbroom
- Owner: gpanders
- License: mit
- Created: 2015-12-03T21:52:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-08T03:06:14.000Z (almost 4 years ago)
- Last Synced: 2025-02-25T22:11:13.557Z (2 months ago)
- Topics: python
- Language: Python
- Homepage: https://sr.ht/~gpanders/pushbroom
- Size: 67.4 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pushbroom
`pushbroom` is a tool designed to help keep your filesystem clear of clutter.
Certain directories, such as your downloads directory, tend to accumulate a
large amount of old files that take up space. Over time, this clutter can
accumulate to a significant amount of storage space. `pushbroom` gives you an
easy way to remove these old files.`pushbroom` is written in Python and should therefore work on any platform that
can run Python. For now, it is only officially supported for macOS and Linux.## Installation
### Package Manager
The following package managers support `pushbroom`:
#### MacPorts
sudo port install pushbroom
### pip
Install using pip:
pip install --user pushbroom
You must also copy the [example configuration file][] to
`~/.config/pushbroom/config` or create your own from scratch.[example configuration file]: ./pushbroom.conf
### From source
Check the [releases][] page for the latest release. Download and extract the
archive, then install with pip:tar xzf pushbroom-vX.Y.Z.tar.gz
cd pushbroom-vX.Y.Z
pip install --user .
cp pushbroom.conf ~/.config/pushbroom/config[releases]: https://git.sr.ht/~gpanders/pushbroom/refs
## Usage
`pushbroom` can be run from the command line using:
pushbroom
Use `pushbroom --help` to see a list of command line options.
## Configuration
The `pushbroom` configuration file is organized into sections where each section
represents a directory path to monitor. The default configuration file looks
like this:[Downloads]
Path = ~/Downloads
Trash = ~/.Trash
NumDays = 30This means that, by default, `pushbroom` will monitor your ~/Downloads folder and
move any file or folder older than 30 days into your ~/.Trash directory.If you don't want to move files into ~/.Trash but instead want to just delete
them, simply remove the `Trash` option:[Downloads]
Path = ~/Downloads
NumDays = 30The name of the section (`Downloads` in this example) is not important and can
be anything you want:[Home Directory]
Path = ~
NumDays = 90You can also specify an `Ignore` parameter to instruct `pushbroom` to ignore any
files or directories that match the given glob:[Downloads]
Path = ~/Downloads
NumDays = 30
Ignore = folder_to_keepSimilarly, you can specify `Match` to have `pushbroom` only remove files that
match one of the given patterns:[Vim Backup Directory]
Path = ~/.cache/vim/backup
NumDays = 90
Match = *~Both `Ignore` and `Match` can be a list of patterns separated by commas.
[Home Directory]
Path = ~
NumDays = 365
Match = .*
Ignore = .local, .config, .cache, .vimNote that `.*` **is not** a regular expression for "match everything", but
rather a _glob expression_ for "all files that start with a period".---
The following configuration items are recognized in `pushbroom.conf`:
### Path
**Required**
Absolute path to a directory to monitor. Tildes (`~`) are expanded to the
user's home directory.### Trash
Specify where to move files after deletion. If omitted, files will simply be
deleted.### NumDays
**Required**
Number of days to keep files in `Path` before they are removed.
### Ignore
**Default**: None
List of glob expression patterns of files or directories to ignore.
### Match
**Default**: `*`
List of glob expression patterns of files or directories to remove. If omitted,
everything is removed.### Shred
**Default**: False
Securely delete files before removing them. Note that this option is mutually
exclusive with the [`Trash`](#trash) option, with `Trash` taking precedence if
both options are used.### RemoveEmpty
**Default**: True
Remove empty subdirectories from monitored paths.
## Automating
If you are using a Linux distribution that uses systemd, you can copy the
[systemd service][] and [timer][] files to `~/.local/share/systemd/` and enable
the service withsystemctl --user enable --now pushbroom
Note that you may need to change the path to the `pushbroom` script in the
service file depending on your method of installation.Another option is to install a crontab entry
0 */1 * * * /usr/local/bin/pushbroom
[systemd service]: ./contrib/systemd/pushbroom.service
[timer]: ./contrib/systemd/pushbroom.timer## Contributing
[Send patches][] and questions to [~gpanders/[email protected]][].
Report a bug or open a ticket at [todo.sr.ht/~gpanders/pushbroom][].
[Send patches]: https://git-send-email.io
[~gpanders/[email protected]]: https://lists.sr.ht/~gpanders/pushbroom
[todo.sr.ht/~gpanders/pushbroom]: https://todo.sr.ht/~gpanders/pushbroom## Similar Work
- [Belvedere](https://github.com/mshorts/belvedere): An automated file manager
for Windows
- [Hazel](https://www.noodlesoft.com/): Automated Organization for your Mac