clean_files

package module
v0.0.0-...-6f99e60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

README

File cleanup utility

Utility and system service to clean up unused files.

Installation

TODO: Make it easy to install this on Win, Lin, Mac?

Configuration

Main configuration file in /etc/cleanup-files.toml, /usr/local/etc/cleanup-files.toml, C:\ProgramData\cleanup-files\cleanup-files.toml or C:\Program Files\cleanup-files\cleanup-files.toml, or defined via -c path/to/cleanup-files.toml.

[main]
clean_frequency = "60s" # supports ms, s, m, h

Main configuration and user configuration can also define cleanup rules. User configuration files are looked for in /home/*/.cleanup-files.toml, /Users/*/.cleanup-files.toml and, C:\Users\*\.cleanup-files.toml when in service mode.

[globs.downloads]
globs = ["/home/*/Downloads/**/*", "C:\\Users\\*\\Downloads\\**\\*"]
keep_days = 14  # Each day is exactly 24 hours, value of 0 is ignored
# or
keep = "1h" # supports ms, s, m, h

Running

One-shot, only runs once, with only config for current user being parsed.

clean-files
# or
clean-files -c path/to/cleanup-files.toml

As a service, stays in the background and periodically checks for updates.

clean-files --monitor

Development

Ensure you have pre-commit installed and you run pre-commit install in the repo root.

License

Short answer: This software is licensed with the BSD 3-clause -license.

Long answer: The license for this software is in LICENSE.md, the libraries used may have varying other licenses that you need to be separately aware of.

Financial support

This project has been made possible thanks to Cocreators and Lietu. You can help us continue our open source work by supporting us on Buy me a coffee.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentUserConfigs = []string{
	"$HOME/.cleanup-files.toml",
	"/home/$USER/.cleanup-files.toml",
	"/Users/$USER/.cleanup-files.toml",
}
View Source
var GlobalConfigs = []string{
	"/etc/cleanup-files.toml",
	"/usr/local/etc/cleanup-files.toml",
}

Functions

func ConfigureLogger

func ConfigureLogger()

Types

type GlobalConfig

type GlobalConfig struct {
	CleanFrequency time.Duration
	Rules          map[string]Rule
}

func ReadGlobalConfig

func ReadGlobalConfig(configFile string) GlobalConfig

type Rule

type Rule struct {
	Globs []string
	Keep  time.Duration
}

type UserConfig

type UserConfig struct {
	Rules map[string]Rule
}

func ReadUserConfig

func ReadUserConfig(configFile string) UserConfig

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL