Skip to content

Commit

Permalink
upload scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
rdewald committed Feb 5, 2022
1 parent 6653825 commit 1a32a44
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions Renviron_example.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Microsoft 365 personal token
# note: this is not a real token below, it will be hex
microsoft365r_use_cli_app_id = abefc027egabb67a
# note: this is not a real token below, real ones are hexadecimal
microsoft365r_use_cli_app_id = abcdefg027ega67a
# OneDrive My Way session file variables
# NB: do not add the trailing slash
# relative path to the staging folder
ODMW_dest = stash_this
# path to the oneDrive destination folder
ODMW_dest = work_stuff

14 changes: 12 additions & 2 deletions rdewald.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# oneDrive backup script
#
library(Microsoft365R)
od <- get_personal_onedrive()
od$upload_file("staging/Bayesian_primer.pdf", dest = "Bayesian_primer.pdf")
od$upload_file("staging/cost_of_hope.pdf", dest = "cost_of_hope.pdf")
uploads <- list.files(Sys.getenv("ODMW_staging"))
paste("staged for upload: ", uploads[])
for (i in seq_along(uploads)) {
od$upload_file(paste0(Sys.getenv("ODMW_staging")
, "/"
, stringr::str_trim(uploads[i]))
, dest = paste0(Sys.getenv("ODMW_dest")
, "/"
, stringr::str_trim(uploads[i]))
)
}

0 comments on commit 1a32a44

Please sign in to comment.