copy_file: copy file

Description Usage Arguments Details Value

View source: R/copy_files.R

Description

Copy a single file from one location to another

Usage

1
2
copy_file(from_file = NULL, to_dir = ".", json_data = NULL,
  tmp_loc = "/tmp", clean_file_fun = clean_filename)

Arguments

from_file

the location of the original file

to_dir

the location to copy the file to

json_data

the json meta information data

tmp_loc

temp location if you want to specify it

clean_file_fun

function used to rename the file

Details

We want to keep track of information about the copied files, so this function does some stuff to help us out. It strips special characters from the base file name, copies the file to a temp location, calculates the SHA-1 hash of the file, checks the JSON meta file for matches to the SHA-1, and if there are none, copies the renamed file to the copy location.

If a matching instance of SHA-1 hashes are found, then the file path is added to the entry for that file location.

If a matching file name is found but with a different SHA-1 hash, then the first 8 characters of the SHA-1 hash are appended to the file, and it is added to the database.

Value

list


rmflight/waitcopy documentation built on May 24, 2019, 6:18 a.m.