mirror: Create mirror of a directory (copy)

Description Usage Arguments Details Note See Also Examples

View source: R/mirror.R

Description

mirror copies files from from to to, deleting any files in to that are not present in from.

Usage

1
mirror(from, to, exclude = "")

Arguments

from

path of source directory

to

path of destination directory

exclude

character vector of files or folders to exclude; paths are relative

Details

Uses rsync. Essentially creates a copy of from at to.

Note

When syncing the contents of a directory, remember that it is important to include a forward slash (/) at the end of both paths a and b; omitting in the second will create an extra copy in the first. If slash omitted from both, the top level name will exist 3 times and include two replicates. This is just basic rsync syntax, but it is easy to forget.

See Also

See sync for bidirectional copying w/o deletions (syncing). See rbLib-package for package overview.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# I have a project in a folder called 'CyanoIso'
# I want two copies of this folder and its contents on my computer
from <- "Documents/School&Work/WiscResearch/CyanoIso/"
to <- "Dropbox/Cyanotopes/CyanoIso/" # omitting last slash creates extra copy
exclude <- c(".git", "Data")
(mirror(from, to, exclude))

## End(Not run)

rBatt/rbLib documentation built on May 26, 2019, 7:45 p.m.