Crate dir_cleaner

Crate dir_cleaner 

Source
Expand description

§dir_cleaner

A simple binary crate written in order to learn how to create, organize and distribute Rust apps.

The main purpose of the crate is to help you identify duplicate files in nested directories and simplify their deletion (if necessary).

The crate is super simple to use, just call it from the command line and provide the relative path of the folder you want to inspect.

dir_cleaner ./test

Once you’ve done so, the program will ask you for a file name; such a name will be used to find any file with that exact name on the specified directory and its respective subdirectories. Then, the program will proceed to expose the list of the found files (along with their creation_date and their relative path) and ask you if you want to keep all of them, if that’s not the case it will help you with the deletion process.

Structs§

File
Stores relevant information (and some metadata) associated with a specific file, in order to simply its manipulation at fs-level (E.G: Access, Deletion, Modification).

Functions§

get_dir_files
Recursively traverses the directory located in the provided path and its respective subdirectories, in order to gather the information of the files that have the provided file_name and collect it into a Vec of Files.
get_input
Prints the provided message to stdout and proceeds to get user input.
run
Proceeds to gather the files located on the directory represented by the path specified through args, as long as they match the name provided by the user when prompted to do. Once the information of the different files is collected, the user will have the option to keep or delete all of them.