Skip to content

Instantly share code, notes, and snippets.

@chasemc
Created October 30, 2019 21:45
Show Gist options
  • Save chasemc/4760cccd189e8c13cd16d66bff2887d3 to your computer and use it in GitHub Desktop.
Save chasemc/4760cccd189e8c13cd16d66bff2887d3 to your computer and use it in GitHub Desktop.
a <- 'C:/Users/chase/Downloads/2019_10_30_christie/bruker'
file_names <- list.files(a)
file_names_path <- list.files(a, full.names = TRUE)
z <- sapply(file_names, function(x) strsplit(x, "0_")[[1]][[2]] )
b <- c("H10")
file_names_path[which(z %in% b)]
my_loop_results <- lapply(sample_names,
function(x){
a <- which(file_names %in% x)
file_names_path[a]
})
for(i in seq_along(my_loop_results)) {
a <- file.path("my/path/somewhere", names(my_loop_results)[[i]]
dir.create(a)
for(y in my_loop_results[[i]]) {
file.copy(my_loop_results[[i]][[y]],
a,
recursive = T)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment