winget install --id=danstis.rmstale -e
rmstale is a tool to remove stale files recursively below a given directory. Files and folders older than a defined period are removed.
rmstale is a command-line tool designed to remove stale files recursively below a given directory. It identifies and deletes files and folders that have not been modified for a specified period of time, helping users maintain clean and organized file systems.
Key Features:
Audience & Benefit: Ideal for system administrators, developers, and anyone needing to manage disk space. It streamlines maintenance by automatically removing outdated files, reducing manual effort and enhancing efficiency.
rmstale is a tool to remove stale files recursively below a given directory.
Files and folders older than a defined period are removed.
A file is considered stale if it has not been modified in the last N days, where N is the value provided for the --age
flag.
This tool will also remove directories that are considered stale (older than the defined period) and are empty.
Some examples for use:
choco install rmstale
winget install danstis.rmstale
Visit the releases page to find the latest release version.
# Fetch the latest release tag from GitHub
latest_version=$(curl -s https://api.github.com/repos/danstis/rmstale/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')
# Download the latest version tarball
curl -L -o rmstale.tar.gz "https://github.com/danstis/rmstale/releases/download/$latest_version/rmstale_${latest_version#v}_linux_amd64.tar.gz"
# Extract and install
sudo tar -xzf rmstale.tar.gz -C /usr/bin rmstale
# Cleanup
rm rmstale.tar.gz
Flag | Description | Default |
---|
-a, --age | Period in days before an item is considered stale. (REQUIRED) | (required) |
-d, --dry-run | Runs the process in dry-run mode. No files will be removed, but the tool will log the files that would be deleted. | false |
-e, --extension | Filter files for a defined file extension. This flag only applies to files, not directories. | (empty) |
-p, --path | Path to a folder to process. | system temp dir |
-v, --version | Displays the version of rmstale that is currently running. | false |
-y, --confirm | Allows for processing without confirmation prompt, useful for scheduling. | false |
>: rmstale --version
rmstale v1.2.3
>: rmstale --age 14 --path c:\temp
WARNING: Will remove files and folders recursively below 'c:\temp' older than 14 days. Continue?: y
-Removing 'C:\Temp\amc2E40.tmp.LOG1'...
-Removing 'C:\Temp\amc2E40.tmp.LOG2'...
-Removing 'C:\Temp\amc306D.tmp.LOG1'...
-Removing 'C:\Temp\amc306D.tmp.LOG2'...
-Removing 'C:\Temp\amc308D.tmp.LOG1'...
Any errors encountered during the deletion process (e.g., permission issues) will be logged.
Feedback, Issues, Bugs and Contribution to this tool are welcome. For Bugs/Issues/Feature requests, please create an issue on the GitHub issues page.
Want to contribute? Great:
This project follows semantic versioning (SemVer) for releases. To create a new release:
v1.2.3
).v1.2.3
(where 1 is the major version, 2 is the minor version, and 3 is the patch version) and push the tag to the repository.