box_dir_diff
is the internal function used by
box_fetch
and box_push
to determine how to
which files and folders should be uploaded/downloaded, updated,
or deleted, to synchronize remote and local directories.
box_dir_diff(dir_id = box_getwd(), local_dir = getwd(), load = "up", folders = FALSE)
logical
. Should the results be in the context of an upload
or a download operation? Permitted values are "up"
or "down"
logical
. Should folders/directories be included in the
result?boxr_dir_comparison
, describing the
differences between the files.It is a named list, it's entries containing data.frames
,
describing the files in each of the following categories:box_dir_diff
works by comparing files in the 'origin' to
those in the 'destination'.
For downloading files (e.g. with box_fetch
), the origin is
the remote folder on box.com specified with dir_id
, and the
destination would be the local directory specified by local_dir
.
The reverse is true for uploads (e.g. via box_fetch
).
box_dir_diff
decides what should happen to a file based on three
peices of information:
Why not use the content modified time for both?
With regards to the box.com API, modified_at
is preferred to
content_modified_at
, as it includes changes to the file outside of
just it's content. This means that, for example, a collaborator could
roll back to a previous version of a file, or upload a preferred but
older version. These actions count as modifications on the box.com
servers, but not to the content of the file itself (they are reflected
in modified_at
, but not content_modified_at
).
Implementing similar functionality for local files is not possible in a
platform-independent manner; content modified time is the only file-based
timestamp which has a consistent defintion for UNIX and Windows
systems.
box_fetch
and box_push
, which depend on
this internal function, file.info
for timestamps describing
local files, digest
for details of the sha1
algorithm
implementation.