Skip to content

Commit

Permalink
merge similar code
Browse files Browse the repository at this point in the history
  • Loading branch information
lizihao-anu committed May 20, 2024
1 parent 8f07d34 commit 4975a75
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions 00_Sort_BI_Extracts.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,22 @@ move_temps_to_year_extract <- function(csv_file, compress_files = TRUE) {
slfhelper::get_anon_chi() %>%
readr::write_csv(file = new_file_path)
cat("Replaced chi with anon chi:", csv_file, "to", new_file_path, "\n")

# compress file
if (compress_files) {
cat("Compressing:", basename(new_file_path), "\n")
system2(
command = "gzip",
args = shQuote(new_file_path)
)
}
file.remove(csv_file)
} else {
new_file_path <- file.path(financial_year_dir, basename(csv_file))
fs::file_copy(csv_file, new_file_path, overwrite = TRUE)
cat("Moved", csv_file, "to", new_file_path, "\n")
}

# compress file
if (compress_files) {
cat("Compressing:", basename(new_file_path), "\n")
system2(
command = "gzip",
args = shQuote(new_file_path)
)
}
file.remove(csv_file)
# compress file
if (compress_files) {
cat("Compressing:", basename(new_file_path), "\n")
system2(
command = "gzip",
args = shQuote(new_file_path)
)
}
# remove old files
file.remove(csv_file)
}
}

Expand Down

0 comments on commit 4975a75

Please sign in to comment.