use std::path::Path; use anyhow::Result; use log::trace; use posix_acl::PosixACL; use walkdir::WalkDir; pub fn write_acl_recursive>(path: P, acl: PosixACL) -> Result<()> { for entry in WalkDir::new(path).min_depth(0).follow_links(false) { let entry = entry?; let path = entry.path(); trace!("Writing ACL for: {:?} {:?}", path, acl); match entry.file_type().is_dir() { true => { acl.write(&path)?; acl.write_default(&path)?; } false => { acl.write(&path)?; } } } Ok(()) }