I am currently decoupling my small FS utils from my current project and I am considering either to contribute them to an existing crate or to create my own crate. Would you be interested in receiving the following utils?
clean up a folder (drop all the files and directories from the target folder, while keeping the target folder):
pubfncleanup_folder<P:AsRef<Path>>(folder_path:P) -> io::Result<()>{for entry in fs::read_dir(&folder_path)? {let path = entry?.path();if path.is_dir(){
fs::remove_dir_all(&path)?;}else{
fs::remove_file(&path)?;}}if fs::read_dir(&folder_path)?.take(1).count() > 0{returnErr(io::Error::new(io::ErrorKind::Other,"The folder is not clean"));}Ok(())}
helper to read only first N bytes from a file (like head util)