ftp_client: ftp client

Description Arguments Details Examples

View source: R/ftp-client.R

Description

ftp client

Arguments

path

(character) a path to cache files in. required

type

(character) type of cache. One of user_cache_dir (default), user_log_dir, user_data_dir, user_config_dir, site_data_dir, site_config_dir. required

Details

Methods

pwd()

Print working directory

cd()

Change directory

ftp_port()

Change ftp port

set_pasv()

Change directory

get()

Get a file from remote server

list()

List files on remote server

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
(x <- ftp_client("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/"))
x$pwd()
x$list()

x$cd("daily")
x$pwd()
x$list()

# turn on active
x$set_pasv(TRUE)
x

# change port
# x$ftp_port(4567)

# get a file
x$get('ghcnd-states.txt', disk = (f <- tempfile()))
readLines(f, n = 10)
close(file(f))

# put a file
x <- ftp_client("ftp://speedtest.tele2.net/")
x$cd('upload')
x$list()
f <- tempfile(fileext = ".txt")
writeLines("foo\nbar\n", con = f)
readLines(f)
res <- x$put(f, TRUE)

## End(Not run)

sckott/ftp documentation built on Sept. 3, 2020, 7:22 p.m.