Backup folder for OPUS files
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -46,5 +46,4 @@ po/*~
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Folders
 | 
					# Folders
 | 
				
			||||||
DPT/
 | 
					DPT/
 | 
				
			||||||
OPUS/
 | 
					OPUS*/
 | 
				
			||||||
OPUS_save/
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							@@ -1,16 +1,20 @@
 | 
				
			|||||||
#!/usr/bin/env Rscript
 | 
					#!/usr/bin/env Rscript
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Attach packages to workspace, execute with every new session
 | 
					# Attach packages to workspace, execute with every new session
 | 
				
			||||||
 | 
					library("filesstrings")
 | 
				
			||||||
source("ReadOpus.R")
 | 
					source("ReadOpus.R")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Determine file path
 | 
					# Determine file path
 | 
				
			||||||
path <- commandArgs(trailingOnly = TRUE)[1]
 | 
					path <- commandArgs(trailingOnly = TRUE)[1]
 | 
				
			||||||
file_name <- commandArgs(trailingOnly = TRUE)[2]
 | 
					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
 | 
					# Convert opus binary file into dataframe
 | 
				
			||||||
data <- read_opus_univ(file_path, 5)
 | 
					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"
 | 
					# Replace last "." with "_", add ".DPT"
 | 
				
			||||||
file_name <- paste0(sub(".([^.]*)$", "_\\1", file_name), ".DPT")
 | 
					file_name <- paste0(sub(".([^.]*)$", "_\\1", file_name), ".DPT")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user