If you are working on multiple projects you probably encounter fact that lots
of garbage is produced. In many cases clean target from maven, sbt or any
other build tool is not enough. This project want to target this issue. By simple
executing ot-clean you can get rid of all garbage.
Unpack latest release and add it
to your path. You might want to read also How to efficiently manage PATH variable in Windows.
Have a look also at series of the blog posts.
You can create .clean.yml file and specify which files/dirs you would like to
delete. Similar to .gitignore concept but using well known yml file standard.
deletes:
- target
- subproject/target/logs
- ../logs
Under the hood .clean.yml is using DirectoryScanner
and is passing deletes list as inclusion pattern. You can specify paths with
wildcards, for example:
deletes:
- *.log
- subproject/**/logs.txt
- ../logs
Since version 0.5 double quotes are no longer needed. Navigate here if you wondering why they were needed before.
DirectoryScanner
is using quite specific pattern naming. If you want to delete files with specific
extension you have to use "**\*.log", please read below for more examples:
When a name path segment is matched against a pattern path segment, the following special characters can be used: '*' matches zero or more characters '?' matches one character.
Examples:
- "***.class" matches all .class files/dirs in a directory tree.
- "test\a??.java" matches all files/dirs which start with an 'a', then two more characters and then ".java", in a directory called test.
- "**" matches everything in a directory tree.
- "**\test*\XYZ" matches all files/dirs which start with "XYZ" and where there is a parent directory called test (e.g. "abc\test\def\ghi\XYZ123").
from: DirectoryScanner
You can specify directories in dirs: section. It means that you can execute cleaning in single place and clean unrelated directories. Example configuration might look like this:
dirs:
- c:/Users/ggajos/
- ../above/parent
Go to directory you want to perform clean and type ot-clean. No worries,
by default it is going to display only information what could be cleaned up.
No data will be lost. In order to actually remove files you have to provide -d
argument:
ot-clean -d
You can see list of all supported arguments for current version here.
- ✓ 1.0 - Test cases refactoring, test coverage,
vverbose mode, final release - ✓ 0.12 - Do not display dirs if no files found, test coverage, verbose mode
- ✓ 0.11 - Add auto cleaner for Grails application and modules, refactoring
- ✓ 0.10 - Fix log4j configuration, updated readme
- ✓ 0.9 - Add support for multiple base dirs (
dirs:section) - ✓ 0.8 - Removed recurrence parameter
r, cleanup, added coveralls - ✓ 0.7 - Add application version automatically from maven project
- ✓ 0.6 - Add summary about deleted files, dirs and empty total space
- ✓ 0.5 - Preprocess Yaml file so double quotes are no longer needed
- ✓ 0.4 - Support wildcards
- ✓ 0.3 - Add support to delete custom directories via .clean.yml
- ✓ 0.2 - Recurrence parameter
r - ✓ 0.1 - Clean maven project in current directory without using maven