diff --git a/Changelog b/Changelog index 8328dd4..63a7a90 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ ## Version 0.1.3 -- Big code refactoring +- Big code refactoring - now is a lot of easier create new modules and maintain old ones +- Added finding empty files +- Added new option to find duplicates by checking hash max 1MB of file ## Version 0.1.2 - 26.09.2020r - Add basic search empty folders in GTK GUI @@ -23,7 +25,7 @@ - Saving results to file - Print how much data was read by duplicate finder(debug only) - Added Github CI -- Only debug build prints debug infos +- Only debug build prints debug information's - Clean code - Add basic idea config to misc folder diff --git a/README.md b/README.md index 3e436c8..5c54896 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,20 @@ # Czkawka Czkawka is simple, fast and easy to use alternative to Fslint, written in Rust. -It is in very early development, so most of the functions aren't added and doesn't work. -This is my first ever project in Rust so probably a lot of things are written in the most optimal way. +This is my first ever project in Rust so probably a lot of things are not being written in the most optimal way. -## Done -- Rich instruction with examples - CLI(`cargo run --bin czkawka_cli`) -- GTK Frontend(Still WIP) - (`cargo run --bin czkawka_gui`) - - Basic layout - - Remembering of buttons between different tabs -- Orbtk Frontend(Still very early WIP) - (`cargo run --bin czkawka_gui_orbtk`) -- Saving results to file -- Duplicated file finding - - Including and excluding directories(absolute paths) - - Option to remove all except newest, oldest and one oldest or newest - - Fast(by size) or accurate(by hash) file checking - - Support for * wildcard when excluding files and folders - - Checking only selected extensions(default macros like IMAGE, VIDEO, TEXT are available) -- Empty folders finding - - Advanced empty files finding(finds and remove folders which contains only empty folders) - - Option to remove all files +## Features +- Written in fast and memory safe Rust +- CLI frontend, very fast and powerful with rich help +- GUI GTK frontend(Still WIP) - use modern GTK 3 and looks similar to FSlint +- GUI Orbtk frontend(Very early WIP) - alternative GUI with reduced functionality +- Saving results to file - allows to easily read entries found by tool +- Rich search option - allows setting absolute included and excluded directories, set of allowed files extensions or excluded items with * wildcard +- Multiple tools to use: + - Duplicates - Finds duplicates basing on its size(fast) or hash(accurate) + - Empty Folders - Finds empty folders with help of advanced algorithm + - Big Files - Finds provided number of the biggest files in given location + - Empty Files - Looks for empty files across disk + - Temporary Files - Allows to find files ## TODO - Comments - a lot of things should be described @@ -34,7 +30,6 @@ This is my first ever project in Rust so probably a lot of things are written in - Popups - Choosing directories(included, excluded) - Popup with type of deleted records - - Add Czkawka name to main window(now is czkawka_gui) - Run in another thread searching to be able to pause - Orbtk GUI - Basic selecting included and excluded folders @@ -42,10 +37,12 @@ This is my first ever project in Rust so probably a lot of things are written in - Simple buttons to delete ## Usage and requirements -Rustc 1.46 works fine(not sure about a minimal version) -GTK 3.18 - for GTK backend +Rust 1.46 - probably lower also works fine +GTK 3.24 - for GTK backend -For now only Linux(and probably also macOS) is supported +Precompiled binaries are here(may not work in every Linux distro) - https://github.com/qarmin/czkawka/releases/ + +For now only Linux(and maybe also macOS) is supported - Install requirements for GTK ``` @@ -67,28 +64,12 @@ cargo run --bin czkawka_gui cargo run --bin czkawka_gui_orbtk ``` ![GUI Orbtk](https://user-images.githubusercontent.com/41945903/92405241-7b27fb80-f135-11ea-9fc4-5ebc2b76b011.png) -- Run CLI +- Run CLI(this will print help with a lot of examples) ``` cargo run --bin czkawka_cli ``` ![CLI](https://user-images.githubusercontent.com/41945903/93716816-0bbcfd80-fb72-11ea-8d31-4c87cc2abe6d.png) -## How it works? -### Duplicate Finder -The only required parameter for checking duplicates is included folders `-i`. This parameter validates provided folders - which must have absolute path(without ~ and other similar symbols at the beginning), not contains *(wildcard), be dir(not file or symlink), exists. Later same things are done with excluded folders `-e`. - -Next, this included and excluded folders are optimized due to tree structure of file system: -- Folders which contains another folders are combined(separately for included and excluded) - `/home/pulpet` and `/home/pulpet/a` are combined to `/home/pulpet` -- Included folders which are located inside excluded ones are delete - Included folder `/etc/tomcat/` is deleted because excluded folder is `/etc/` -- Non existed directories are being removed -- Excluded path which are outside included path are deleted - Excluded path `/etc/` is removed if included path is `/home/` -If after optimization there is no included folders, then program ends with non zero value(TODO, this should be handled by returning value). - -Next with provided by user minimal size of checked size `-s`, program checks recursively(TODO should be an option to turn off a recursion) included folders and checks files by sizes and put it files with same sizes to different boxes. -Next boxes which contains only one element are removed because files inside are not duplicated. - -Next by default also is checked hash to be sure that files with equal size are identical. - ## Speed Since Czkawka is written in Rust and aims to be a faster alternative for written in Python - FSlint we need to compare speed of this two tools. @@ -122,5 +103,21 @@ Empty folder finder Differences should be more visible when using slower processor or faster disk. +## How it works? +### Duplicate Finder +The only required parameter for checking duplicates is included folders `-i`. This parameter validates provided folders - which must have absolute path(without ~ and other similar symbols at the beginning), not contains *(wildcard), be dir(not file or symlink), exists. Later same things are done with excluded folders `-e`. + +Next, this included and excluded folders are optimized due to tree structure of file system: +- Folders which contains another folders are combined(separately for included and excluded) - `/home/pulpet` and `/home/pulpet/a` are combined to `/home/pulpet` +- Included folders which are located inside excluded ones are delete - Included folder `/etc/tomcat/` is deleted because excluded folder is `/etc/` +- Non existed directories are being removed +- Excluded path which are outside included path are deleted - Excluded path `/etc/` is removed if included path is `/home/` +If after optimization there is no included folders, then program ends with non zero value(TODO, this should be handled by returning value). + +Next with provided by user minimal size of checked size `-s`, program checks recursively(TODO should be an option to turn off a recursion) included folders and checks files by sizes and put it files with same sizes to different boxes. +Next boxes which contains only one element are removed because files inside are not duplicated. + +Next by default also is checked hash to be sure that files with equal size are identical. + ## License Code is distributed under MIT license. diff --git a/czkawka_cli/src/main.rs b/czkawka_cli/src/main.rs index 650218c..6c83765 100644 --- a/czkawka_cli/src/main.rs +++ b/czkawka_cli/src/main.rs @@ -251,9 +251,11 @@ fn main() { println!("FATAL ERROR: Parameter -i with set of included files is required."); process::exit(1); } + if ArgumentsPair::has_command(&arguments, "-e") { yf.set_excluded_directory(ArgumentsPair::get_argument(&arguments, "-e", false)); } + if ArgumentsPair::has_command(&arguments, "-k") { yf.set_excluded_items(ArgumentsPair::get_argument(&arguments, "-k", false)); } @@ -304,7 +306,6 @@ Usage of Czkawka: czkawka --help czkawka - --d <-i directory_to_search> [-e exclude_directories = ""] [-k excluded_items = ""] [-s min_size = 1024] [-x allowed_extension = ""] [-l type_of_search = "hash"] [-o] [-f file_to_save = "results.txt"] [-delete = "aeo"] - search for duplicates files -i directory_to_search - list of directories which should will be searched like /home/rafal -e exclude_directories - list of directories which will be excluded from search. @@ -322,7 +323,6 @@ Usage of Czkawka: czkawka --d -i "/var/" -k "/var/l*b/,/var/lo*,*tmp" czkawka --d -i "/etc/" -delete "aeo" - --e <-i directory_to_search> [-e exclude_directories = ""] [-o] [-f file_to_save] [-delete] - option to find and delete empty folders -i directory_to_search - list of directories which should will be searched like /home/rafal -e exclude_directories - list of directories which will be excluded from search. @@ -341,7 +341,15 @@ Usage of Czkawka: -l number_of_files - number of showed the biggest files. -x allowed_extension - list of checked extension, e.g. "jpg,mp4" will allow to check "book.jpg" and "car.mp4" but not roman.png. There are also helpful macros which allow to easy use a typcal extension like IMAGE("jpg,kra,gif,png,bmp,tiff,webp,hdr,svg") or TEXT("txt,doc,docx,odt,rtf") - --y <-i directory_to_search> [-e exclude_directories = ""] [-k excluded_items = ""] [-o] [-f file_to_save = "results.txt"] [-delete] - search for duplicates files + --y <-i directory_to_search> [-e exclude_directories = ""] [-k excluded_items = ""] [-o] [-f file_to_save = "results.txt"] [-delete] - search and delete empty files + -i directory_to_search - list of directories which should will be searched like /home/rafal + -e exclude_directories - list of directories which will be excluded from search. + -k excluded_items - list of excluded items which contains * wildcard(may be slow) + -o - this options prevents from recursive check of folders + -f file_to_save - saves results to file + -delete - delete found files + + --t <-i directory_to_search> [-e exclude_directories = ""] [-k excluded_items = ""] [-o] [-f file_to_save = "results.txt"] [-delete] - search for temporary files -i directory_to_search - list of directories which should will be searched like /home/rafal -e exclude_directories - list of directories which will be excluded from search. -k excluded_items - list of excluded items which contains * wildcard(may be slow)