Learn R Programming

boxr (version 0.3.3)

box_dir_diff: Compare the contents of Remote and Local Directories

Description

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.

Usage

box_dir_diff(dir_id = box_getwd(), local_dir = getwd(), load = "up", folders = FALSE)

Arguments

dir_id
The id of the box.com folder which you'd like to use for the comparison
local_dir
The path of the local folder which you'd like to use for the comparison
load
logical. Should the results be in the context of an upload or a download operation? Permitted values are "up" or "down"
folders
logical. Should folders/directories be included in the result?

Value

An object of class 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:

Details

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.

References

https://developers.box.com/docs

See Also

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.