-
Notifications
You must be signed in to change notification settings - Fork 7
/
figshare upload code.R
52 lines (40 loc) · 1.3 KB
/
figshare upload code.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## code for writing files into one fileset of figshare
#install.packages(c("rfigshare","rjson"))
require(rfigshare)
require(rjson)
#give figshare access codes
options(FigshareKey = "jBkrLNsYbeov2oM09cXBBw")
options(FigsharePrivateKey = "LhQkDeJaVJzAhWRIKYeobA")
options(FigshareToken = "BYuYn4OjWjd8njBKCyeFXQOEAYY1MfLJ1Y0z80rVWj6AXYuYn4OjWjd8njXKCyeFXQ")
options(FigsharePrivateToken = "aC2q4lBod3Xl52CeKwp7Fg")
#filesetid= "807697"
filesetid="826026"
fs_auth()
setwd("/Users/choupi/Desktop/boulot/FSdata")
metafile= read.csv ("metafile.csv", header=TRUE)[,-1]
setwd("/Users/choupi/Desktop/boulot/FSdata/alldata")
DFN= metafile$rawfilename
det=fs_download(article_id = filesetid)
##
alreadyuploaded=c()
newuploaded = c()
nup=0
newup=0
for (i in c(1: 8)){
#for (i in c(1: length(DFN))){
test= DFN[i]
if (!all(!grepl(test, det))){
nup=nup+1
alreadyuploaded= c(alreadyuploaded,test)
}else{
#toupload= test
print(i)
if (as.character(test) != "not_accessible"){
fs_upload(article_id=filesetid, file= as.character(test))
#scan(as.character(test),nlines = 1, what = character())
}
newup= newup +1
newuploaded== c(newuploaded,test)
}
}
message(paste(nup," files were already uploaded. type alreadyuploaded to get a list, type newuploaded for a list of files newly uploaded"))