fs_utils/
check.rs

1
2
3
4
5
6
7
//! Functions to check some properties of files and directories.
use std::{fs, io, path::Path};

/// Checks if the given folder is empty.
pub fn is_folder_empty(path: impl AsRef<Path>) -> io::Result<bool> {
    Ok(fs::read_dir(path)?.take(1).count() == 0)
}