Skip to content

Instantly share code, notes, and snippets.

@jefferis
Last active November 27, 2016 19:03
Show Gist options
  • Save jefferis/4a986906490ea22967d37a939295f891 to your computer and use it in GitHub Desktop.
Save jefferis/4a986906490ea22967d37a939295f891 to your computer and use it in GitHub Desktop.
untarring fafb tiles
#' Untar a folder of FAFB tar files to a destination disk
#'
#' @param src The src folder (typically representing a whole drive)
#' @param dest The dest folder (will be created if required)
#'
#' @return
#' @export
untar_fafb <- function(src, dest){
if(!file.exists(src)) stop("No src folder: ", src)
if(!file.exists(dest)) {
message("Making dest folder: ", dest)
dir.create(dest, recursive = TRUE)
}
ff=dir(src, full.names = TRUE)
pb=progress::progress_bar$new(
format = "[:bar] (:current/:total) :elapsed (eta: :eta)",
total = length(ff), clear = FALSE, width= 80)
for(f in ff) {
untar(f, exdir = normalizePath(dest))
pb$tick()
}
}
devtools::source_gist("4a986906490ea22967d37a939295f891", filename = `untar.R`)
setwd("/media/jefferis/FAFBV13_HDD_0/v13_align_tps/")
outd="/fafbz/fafb13/v13_align_tps/"
dirs=dir()
for (d in dirs){
untar_fafb(d, file.path(outd, d))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment