Backup folder for OPUS files

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2021-02-19 13:30:04 +00:00
parent c676cb5424
commit 4fe43d8ecb
3 changed files with 6 additions and 3 deletions

3
.gitignore vendored
View File

@ -46,5 +46,4 @@ po/*~
# Folders
DPT/
OPUS/
OPUS_save/
OPUS*/

Binary file not shown.

View File

@ -1,16 +1,20 @@
#!/usr/bin/env Rscript
# Attach packages to workspace, execute with every new session
library("filesstrings")
source("ReadOpus.R")
# Determine file path
path <- commandArgs(trailingOnly = TRUE)[1]
file_name <- commandArgs(trailingOnly = TRUE)[2]
file_path <- paste(path, file_name, sep = "")
file_path <- paste0(path, file_name)
# Convert opus binary file into dataframe
data <- read_opus_univ(file_path, 5)
# Move the file to OPUS_old where it will remain temporarily in case of an error
file.move(file_path, "OPUS_old/")
# Replace last "." with "_", add ".DPT"
file_name <- paste0(sub(".([^.]*)$", "_\\1", file_name), ".DPT")