aws_file_rename: Rename remote files

View source: R/files.R

aws_file_renameR Documentation

Rename remote files

Description

Rename remote files

Usage

aws_file_rename(remote_path, new_remote_path, ...)

Arguments

remote_path

(character) one or more remote S3 paths. required

new_remote_path

(character) one or more remote S3 paths. required. length must match remote_path

...

named parameters passed on to s3fs::s3_file_move()

Value

vector of paths, length matches length(remote_path)

See Also

Other files: aws_file_attr(), aws_file_copy(), aws_file_delete(), aws_file_download(), aws_file_exists(), aws_file_upload(), six_file_upload()

Examples


bucket <- random_bucket()
aws_bucket_create(bucket)

# rename files
tfiles <- replicate(n = 3, tempfile())
for (i in tfiles) cat("Hello\nWorld\n", file = i)
paths <- s3_path(bucket, c("aaa", "bbb", "ccc"), ext = "txt")
aws_file_upload(tfiles, paths)
new_paths <- s3_path(bucket, c("new_aaa", "new_bbb", "new_ccc"),
  ext = "txt"
)
aws_file_rename(paths, new_paths)

# Cleanup
six_bucket_delete(bucket, force = TRUE)


sixtyfour documentation built on April 3, 2025, 8:22 p.m.