Skip to content

Instantly share code, notes, and snippets.

@tukachev
Created October 13, 2015 20:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tukachev/ebc6103978301dc3ad12 to your computer and use it in GitHub Desktop.
Save tukachev/ebc6103978301dc3ad12 to your computer and use it in GitHub Desktop.
pdf2txt
dest <- "~/pdf"
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
sapply(myfiles, FUN = function(i){
file.rename(from = i, to = paste0(dirname(i), "/", gsub(" ", "", basename(i))))
})
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
lapply(myfiles, function(i) system(paste('"pdftotext" -layout', paste0('"', i, '"')), wait = FALSE) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment