move_files: Move files around.

Description Usage Arguments Details Value Examples

Description

Move specified files into specified directories

Usage

1
2
3
move_files(files, destinations, overwrite = FALSE)

file.move(files, destinations, overwrite = FALSE)

Arguments

files

A character vector of files to move (relative or absolute paths).

destinations

A character vector of the destination directories into which to move the files.

overwrite

Allow overwriting of files? Default no.

Details

If there are n files, there must be either 1 or n directories. If there is one directory, then all n files are moved there. If there are n directories, then each file is put into its respective directory. This function also works to move directories.

If you try to move files to a directory that doesn't exist, the directory is first created and then the files are put inside.

Value

Invisibly, a logical vector with a TRUE for each time the operation succeeded and a FALSE for every fail.

Examples

1
2
3
4
5
6
7
## Not run: 
dir.create("dir")
files <- c("1litres_1.txt", "1litres_30.txt", "3litres_5.txt")
file.create(files)
file.move(files, "dir")

## End(Not run)

Example output

Loading required package: stringr
[1] TRUE TRUE TRUE
3 files moved. 0 failed.

filesstrings documentation built on April 18, 2021, 9:12 a.m.