wflow_rename {workflowr}R Documentation

Rename files and directories

Description

wflow_rename renames files and directories. If the file to be renamed is an R Markdown file, the corresponding HTML and other related files are also renamed. If the workflowr project uses Git, wflow_rename commits the changes.

Usage

wflow_rename(
  files,
  to,
  message = NULL,
  git = TRUE,
  dry_run = FALSE,
  project = "."
)

Arguments

files

character. Files to be renamed. Supports file globbing.

to

character. New names for the files. Must be the same length as files.

message

character (default: NULL). A commit message.

git

logical (default: TRUE). Commit the changes (only applicable if Git repository is present).

dry_run

logical (default: FALSE). Preview the files to be renamed but do not actually rename them.

project

character (default: ".") By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory.

Value

An object of class wflow_rename, which is a list with the following elements:

See Also

wflow_git_commit

Examples

## Not run: 

# rename a single file
wflow_rename("analysis/file.Rmd", "analysis/new.Rmd", "rename old analysis.")
# rename multiple files
wflow_rename(c("analysis/file.Rmd", "output/small-data.txt"),
             c("analysis/new.Rmd", "output/new-data.txt"),
             "rename old analysis and its associated data.")

## End(Not run)


[Package workflowr version 1.7.1 Index]