getUpdates <- function(out_path,url="ftp://ftp.ncbi.nlm.nih.gov/pubchem/Compound/Monthly/"){
library(RCurl)
# get month directories
dirnames <- getURL(url,ftp.use.epsv = FALSE,dirlistonly = TRUE)
dirnames <- strsplit(dirnames,"\r\n")[[1]]
for (x in 1:length(dirnames)){
# Create month folder for output
dir.create(paste(out_path,dirnames[x],sep="/"))
# Get availble months
dir_contents <- getURL(paste(url,dirnames[x],"/",sep=""),ftp.use.epsv = FALSE,dirlistonly = TRUE)
dir_contents <- strsplit(dir_contents,"\r\n")[[1]]
# Download updated cids, killed cids
download.file(paste(url,dirnames[x],"updated-CIDs",sep="/"),paste(out_path,dirnames[x],"updated-CIDs",sep="/"))
download.file(paste(url,dirnames[x],"killed-CIDs",sep="/"),paste(out_path,dirnames[x],"killed-CIDs",sep="/"))
# Download SDF files
dir.create(paste(out_path,dirnames[x],"SDF",sep="/"))
sdf_contents <- getURL(paste(url,dirnames[x],"SDF/",sep="/"),ftp.use.epsv = FALSE,dirlistonly = TRUE)
sdf_contents <- strsplit(sdf_contents,"\r\n")[[1]]
for (i in 1:length(sdf_contents)){
download.file(paste(url,dirnames[x],"SDF",sdf_contents[i],sep="/"),paste(out_path,dirnames[x],"SDF",sdf_contents[i],sep="/"))
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.