-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
New function download_versions()? or improvement of download_files() so that current version file.ext is stored together with all of its versions file_v1.ext, file_v2.ext, etc. in one and the same output folder, similar to the following:
# List problematic file
file_info <- kwb.nextcloud::list_files(
"proposals/**hidden**/***_out_forms",
pattern = "FLUID", full_info = TRUE
)
stopifnot(nrow(file_info) == 1L)
# Get version information about the file
version_info <- kwb.nextcloud::get_version_info(file_info$fileid)
# Download the versions (unfortunately to files with numbers as names)
version_files <- kwb.nextcloud::download_files(href = version_info$href)
# Path to the download folder
target_dir <- dirname(version_files[1])
# New names for downloaded files
extensions <- sprintf("_v%d.xlsx", seq_along(version_files))
filenames <- gsub("\\.xlsx$", extensions, file_info$file)
# Rename the downloaded version files
file.rename(from = version_files, to = file.path(target_dir, filenames))
# Download the current version of the file
kwb.nextcloud::download_files(file_info$href, target_dir)
# Open the download folder
kwb.utils::hsOpenWindowsExplorer(target_dir)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels