The x
argument indicates where on OSF the files will be uploaded (i.e.,
the destination). The path
argument indicates what will be uploaded,
which can include a combination of files and directories.
When path
points to a local file, the file is uploaded to the root of the
specified OSF destination, regardless of where it's on your local machine
(i.e., the intermediate paths are not preserved). For example, the
following would would upload both a.txt
and b.txt
to the root of
my_proj
:
osf_upload(my_proj, c("a.txt", "subdir/b.txt"))`
When path
points to a local directory, a corresponding directory will be
created at the root of the OSF destination, x
, and any files within the
local directory are uploaded to the new OSF directory. Therefore, we could
maintain the directory structure in the above example by passing b.txt
's
parent directory to path
instead of the file itself:
osf_upload(my_proj, c("a.txt", "subdir2"))
Likewise, osf_upload(my_proj, path = ".")
will upload your entire current
working directory to the specified OSF destination.