Skip to main content

build_plan_with_options

Function build_plan_with_options 

Source
pub fn build_plan_with_options(
    root: &Path,
    patterns: &[String],
    options: &PlanOptions,
) -> Result<RemovalPlan>
Expand description

Builds a read-only removal plan with optional modification-time and file-size filtering.

Patterns are combined with OR. Each specified time or size range is combined with the pattern condition and other ranges using AND. When any range is present, only regular files satisfying every keep condition directly match; their ancestors are retained. An empty pattern list omits the pattern condition, but at least one pattern or range is required. Without ranges, behavior matches build_plan.

This operation does not follow child symbolic links and does not provide a filesystem snapshot. Size bounds compare logical file lengths in bytes. A failure to obtain required metadata aborts the entire plan.

ยงErrors

Invalid conditions, roots, and patterns carry ValidationError; traversal, metadata, and path-encoding failures are runtime errors. No partial plan is returned.