Moves or renames an object (dataset, group, etc.) within an HDF5 file.
Details
This function provides an efficient, low-level wrapper for the HDF5
library's H5Lmove function. It is a metadata-only operation, meaning the
data itself is not read or rewritten. This makes it extremely fast, even
for very large datasets.
You can use this function to either rename an object within the same group
(e.g., "data/old" to "data/new") or to move an object to a
different group (e.g., "data/old" to "archive/old"). The destination
parent group will be automatically created if it does not exist.
Examples
file <- tempfile(fileext = ".h5")
h5_write(1:10, file, "group/dataset")
# Review the file structure
h5_str(file)
#> /
#> └── group/
#> └── dataset <uint8 × 10>
# Rename within the same group
h5_move(file, "group/dataset", "group/renamed")
# Review the file structure
h5_str(file)
#> /
#> └── group/
#> └── renamed <uint8 × 10>
# Move to a new group (creates parent automatically)
h5_move(file, "group/renamed", "archive/dataset")
# Review the file structure
h5_str(file)
#> /
#> ├── group/
#> └── archive/
#> └── dataset <uint8 × 10>
unlink(file)
