Learn R Programming

icesTAF (version 3.1-1)

cp: Copy Files

Description

Copy or move files, overwriting existing files if necessary, and returning the result invisibly.

Usage

cp(from, to, move = FALSE)

Arguments

from

source filenames, e.g. *.csv.

to

destination filenames, or directory.

move

whether to move instead of copy.

Value

TRUE for success, FALSE for failure, invisibly.

See Also

file.copy and unlink are the underlying functions used to copy and (if move = TRUE) delete files.

file.rename is the base function to rename files.

icesTAF-package gives an overview of the package.

Examples

Run this code
# NOT RUN {
write(pi, "A.txt")
cp("A.txt", "B.txt")
cp("A.txt", "B.txt", move=TRUE)

## Copy directory tree
cp(system.file(package="datasets"), ".")
mkdir("everything")
cp("datasets/*", "everything")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab