| Crates.io | folder_compare |
| lib.rs | folder_compare |
| version | 0.4.0 |
| created_at | 2020-05-19 22:11:33.989122+00 |
| updated_at | 2020-09-17 17:35:15.03916+00 |
| description | Compare two folders and get a list of changed and new files |
| homepage | https://github.com/tserowski/folder_compare |
| repository | https://github.com/tserowski/folder_compare |
| max_upload_size | |
| id | 243619 |
| size | 19,536 |
A library to recursively compare files in two folders and return two lists of files: One with exclusive Files for the first folder one list with changed files between folders.
folder_compare also takes a list of Strings acting as exclude patterns using RegexSet.
Overall the functionality is comparable to a diff -rq folder1 folder2 -X excludepatterns.pat on unix like systems
For recognizing changed files, hashing with FxHasher is used.
Licensed under Apache-2.0
Add folder_compare as a dependency to your project's
Cargo.toml:
[dependencies]
folder_compare = "0.3"
The following code recursively iterates over two directories and returns lists of changed and new files excluding those with ".doc" and ".txt" as part of the name/path.
use std::path::Path;
use folder_compare;
let excluded = vec![".doc".to_string(), ".txt".to_string()];
let result = FolderCompare::new(Path::new("/tmp/a"), Path::new("/tmp/b"), &excluded).unwrap();
let changed_files = result.changed_files;
let new_filed = result.new_files;