| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/file.R |
| 3 |
\name{file_move} |
| 4 |
\alias{file_move} |
| 5 |
\title{Move or rename files} |
| 6 |
\usage{ |
| 7 |
file_move(path, new_path) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{path}{A character vector of one or more paths.} |
| 11 |
|
| 12 |
\item{new_path}{New file path. If \code{new_path} is existing directory, the file |
| 13 |
will be moved into that directory; otherwise it will be moved/renamed to |
| 14 |
the full path. |
| 15 |
|
| 16 |
Should either be the same length as \code{path}, or a single directory.} |
| 17 |
} |
| 18 |
\value{ |
| 19 |
The new path (invisibly). |
| 20 |
} |
| 21 |
\description{ |
| 22 |
Compared to \link{file.rename} \code{file_move()} always fails if it is unable to move |
| 23 |
a file, rather than signaling a Warning and returning an error code. |
| 24 |
} |
| 25 |
\examples{ |
| 26 |
\dontshow{.old_wd <- setwd(tempdir())} |
| 27 |
file_create("foo") |
| 28 |
file_move("foo", "bar") |
| 29 |
file_exists(c("foo", "bar")) |
| 30 |
file_delete("bar") |
| 31 |
\dontshow{setwd(.old_wd)} |
| 32 |
} |