Disclaimer:
This project was intended to check out rust and learn its concepts and principles. The code is kept simple and I've re-invented a lot to learn how it works (I'm aware of libraries such asclap
andstructop
to build CLIs)
You can find the latest release here, keep in mind that some commands may not exist in older versions.
$ ./cleanup -h
Usage: cleanup <source> <target> [options...]
Flags:
-d, --dry, --dry-run Performs a dry-run, e.g. nothing get's moved.
-h, --help Prints this help text.
-v, --version Prints the current version.
Arguments:
-l, --log-file <file|boolean> Creates (or disables) a log-file in the target folder. Default is 'c
leanup.log'.
-i, --include <extensions...> Move only files with one of the following extensions.
-e, --exclude <extensions...> Exclude certain files by their extension.
Values:
<source> Source directory. Default is the current directory.
<target> Target directory (Default is source + .archive).
Command | Explanation |
---|---|
./cleanup |
This will create a new ./.archive in the current director and move all files (except these which start with a dot and the executable itself) into .archive/[extension]/[file].[extension] . |
./cleanup . etc |
It'll still use the current dir as source (. ) but will move the files into ./etc instead of ./.archive . |
./cleanup -l --ext mp3,iso |
A cleanup.log file will be created inside of ./.archive with information about what has been moved. Files with the exension mp3 and iso are ignored and won't get moved. |
./cleanup ../ ./bam --log-file ../my-log.txt |
Grabs file from the parent-directory and moves them into ./bam (the current directory). The log-file will be create in the _ |
current_ directory and is this time my-log.txt . |
This project is written in rust, clone it via git:
$ git clone https://github.com/Simonwep/cleanup-files
Afterwards you can either run cargo build
or cargo test
to test the project.