rsync: 'removeFile' Remove a file from 'dest'.

View source: R/rsync.R

getDataR Documentation

removeFile Remove a file from dest.

Description

Setup a rsync configuration. The configuration object can be used for access to a folder.

Usage

getData(db, ...)

## Default S3 method:
getData(db, fileName, verbose = FALSE, ...)

getFile(db, ...)

## Default S3 method:
getFile(db, fileName, validate = FALSE, verbose = FALSE, ...)

listFiles(db, ...)

## Default S3 method:
listFiles(db, ...)

removeAllFiles(db, ...)

## Default S3 method:
removeAllFiles(db, verbose = FALSE, ...)

removeFile(db, ...)

## Default S3 method:
removeFile(db, fileName, verbose = FALSE, ...)

rsync(dest, src = getwd(), password = NULL, ssh = NULL, sshProg = NULL)

sendAllFiles(db, ...)

## Default S3 method:
sendAllFiles(db, ...)

sendFile(db, ...)

## Default S3 method:
sendFile(db, fileName, validate = FALSE, verbose = FALSE, ...)

sendObject(db, ...)

## Default S3 method:
sendObject(
  db,
  object,
  objectName = as.character(substitute(object)),
  validate = FALSE,
  verbose = FALSE,
  ...
)

syncAllFiles(db, ...)

## Default S3 method:
syncAllFiles(db, verbose = FALSE, ...)

Arguments

db

(rsync) an object of class 'rsync' initialized with rsync.

...

arguments passed to methods.

fileName

(character) a file name that exists in src

verbose

(logical) if we use 'vorbose' as option in the cli.

validate

(logical) if the file in dest and src should be validated using a sha256 check sum.

dest

(character) the address to the rsync daemon or a folder.

src

(character) a folder.

password

(character|NULL) a password or file name in case a rsync daemon is used.

ssh

(character|NULL) argument is passed as '-e' option on the command line. Can be used to further specify ssh settings.

sshProg

(character|NULL) arguments sets the environment variable 'RSYNC_CONNECT_PROG' during the call. Can be used to setup a ssh connection to a remote rsync daemon.

object

(ANY) any R object you wish to store.

objectName

(character) the name used to store the object. The file extension will always be a 'Rdata'.

Details

getData: sync and load the contents of a file in dest. This can be a Rdata file or a csv or json. The file will be saved in src.

getFile downloads a file from dest and saves it in src.

removeAllFiles remove all entries from dest. src will not be affected.

rsync is a command line tool. For details see https://rsync.samba.org/. From the documentation:

There are two different ways for rsync to contact a remote system: using a remote-shell program as the transport (such as ssh or rsh) or contacting an rsync daemon directly via TCP. The remote-shell transport is used whenever the source or destination path contains a single colon (:) separator after a host specification. Contacting an rsync daemon directly happens when the source or destination path contains a double colon (::) separator after a host specification, OR when an rsync:// URL is specified (see also the "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" section for an exception to this latter rule).

Currently the rsync interface in this package only allows for remote locations in the destination.

You may also establish a daemon connection using a program as a proxy by setting the environment variable RSYNC_CONNECT_PROG to the commands you wish to run in place of making a direct socket connection. This can be done using the sshProg argument.

sendAllFiles Sends all files in src to dest using sendFile.

sendFile Sends a file to a rsync object.

sendObject sends an object (from the environment) to a rsync target. This abstracts a pattern where you would use save followed by sendFile. The reverse is done using getObject

syncAllFiles Syncs all files in src to dest. Files that exist in dest but not in src will be deleted.

Examples

## Not run: 
## Please consider examples in the Readme of this project. To get there run:
browseURL("https://github.com/INWTlab/rsync")

## Using rsync locally
rsync("~/someFolder")

## Examples for remote connections
rsync("rsync://user@host:port/volume", password = "~/my-pwd")
rsync("user@host:~/", ssh = "ssh -i./my-identity-file")
### requires (netcat) on the host
rsync("user@host::volume", sshProg = "ssh -i./my-identity-file host nc %H 873")

## End(Not run)


INWTlab/rsync documentation built on Oct. 25, 2024, 3:50 a.m.