| Crates.io | sizer |
| lib.rs | sizer |
| version | 0.1.0 |
| created_at | 2023-10-17 16:05:47.898892+00 |
| updated_at | 2023-10-17 16:05:47.898892+00 |
| description | his tool searches for files bigger than 100mb in a given directory or the whole file system if no filepath is given |
| homepage | https://github.com/BukiOffor/file-sizer |
| repository | https://github.com/BukiOffor/file-sizer |
| max_upload_size | |
| id | 1005891 |
| size | 37,319 |
This code implements a Rust program that searches for files bigger than 100mb in a given directory or the whole file system if no filepath is given. It uses the clap and std libraries for command line argument parsing and file size calculation, respectively.
// Run the program with a specific directory path
$ ./sizer -p /path/to/directory
// Run the program without specifying a directory path (searches the whole file system)
$ ./sizer
// Run the program with a specific directory path and custom file size threshold
$ ./sizer -p /path/to/directory -s 200
matches: A clap::ArgMatches object that contains the parsed command line arguments.clap to get the matches object.path argument from the matches object.path value is provided, convert it to a PathBuf object and assign it to home_dir.size argument from the matches object.size value is provided, assign it to size as an Option<&String>.path value is provided, call the entry function from the sizer library with home_dir and size as arguments.path value is provided, create a PathBuf object for the root directory ("/") and assign it to root_dir.entry function from the sizer library with root_dir and size as arguments.None. The function performs file size calculations and logging based on the provided command line arguments.