Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

createfolderfromGooglesheet.r 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. library (googlesheets4)
  2. library(dplyr)
  3. #gs_auth()
  4. #
  5. #template_f = gs_url ("https://docs.google.com/spreadsheets/d/1rrl2QcBIQNIQ-D5ugH7FuaiVckItAQxRVlW-Jgb9sdo/edit?ts=5ee10875#gid=1035048464")
  6. #
  7. # data= googlesheets::gs_read_csv(PIlist, skip =2)
  8. template_data <- read_sheet("https://docs.google.com/spreadsheets/d/1rrl2QcBIQNIQ-D5ugH7FuaiVckItAQxRVlW-Jgb9sdo/edit?ts=5ee10875#gid=1035048464")
  9. createtemplate <- function(dirname ="template1", template_data) {
  10. dir.create(dirname)
  11. setwd(dirname)
  12. template_dataf = template_data [(template_data$create != "NULL"),] %>% filter (type == "folder")
  13. for (i in c(nrow(template_dataf):1)){
  14. if (nchar(template_dataf$create[i])<2) {
  15. dir.create(template_dataf$alternative_name[i])
  16. file.create(paste0(template_dataf$alternative_name[i], "/gitdir"))
  17. #file.rename(template_dataf$alternative_name[i], paste0 ("0",template_dataf$create[i],"_",template_dataf$alternative_name[i]))
  18. } else {
  19. dir.create(paste0(template_dataf$create[i], "/",template_dataf$alternative_name[i]), recursive = TRUE)
  20. file.create(paste0(template_dataf$create[i], "/",template_dataf$alternative_name[i], "/gitdir"))
  21. }
  22. }
  23. template_datafile = template_data [(template_data$create != "NULL"),] %>% filter (type == "file")
  24. for (i in c(nrow(template_datafile):1)){
  25. if (template_datafile$create[i] == "parent") {
  26. file.create(template_datafile$alternative_name[i])
  27. } else {
  28. file.create(paste0(template_datafile$create[i], "/",template_datafile$alternative_name[i]))
  29. }
  30. #rename folder with numbers
  31. for (i in c(nrow(template_dataf):1)){
  32. if (nchar(template_dataf$create[i])<2) {
  33. file.rename(template_dataf$alternative_name[i], paste0 ("0",template_dataf$create[i],"_",template_dataf$alternative_name[i]))
  34. }
  35. }
  36. }
  37. setwd("../")
  38. }
  39. setwd("gin-foldertemplate")
  40. template_data$create = as.character(template_data$upfolder_2)
  41. createtemplate(dirname ="template1",template_data)
  42. template_data$create = as.character(template_data$unitial_upfolder)
  43. createtemplate(dirname ="template_ori",template_data)
  44. template_data$create = as.character(template_data$upfolder_3)
  45. createtemplate(dirname ="template_3",template_data)
  46. template_data$create = as.character(template_data$upfolder_2min)
  47. createtemplate(dirname ="upfolder_2min",template_data)