Deletes files sitting in the lake's data path that are not tracked in the DuckLake metadata at all – for example, leftovers from a crashed write.
Usage
delete_orphaned_files(
ducklake_name = NULL,
older_than = NULL,
cleanup_all = FALSE,
dry_run = FALSE
)Arguments
- ducklake_name
Name of the attached DuckLake catalog. If
NULL, the current database is used.- older_than
Only delete files scheduled for deletion before this timestamp (POSIXct, converted to UTC, or character already in UTC). One of
older_thanorcleanup_allis required.- cleanup_all
If
TRUE, delete all scheduled files regardless of when they were scheduled.- dry_run
If
TRUE, only lists the files that would be deleted.
Details
This differs from cleanup_old_files(), which removes files that were
tracked but are scheduled for deletion.
Always run with dry_run = TRUE first and check the file list. Anything
in the data path that DuckLake does not recognise is fair game, and the
comparison is by exact path string: a data path registered with an
irregularity such as a doubled slash (as R's tempdir() produces on
macOS) makes live files look orphaned, and deleting them breaks the
lake.
