Skip to content

Commit

Permalink
new csvs detected
Browse files Browse the repository at this point in the history
  • Loading branch information
davedavemckay committed Jul 2, 2024
1 parent 5bfb88b commit d0c0d58
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion scripts/compare_csv_file_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@
args = parser.parse_args()

log_folder = args.path
datestamp = args.datestamp
datestamp = args.datestamp

def get_new_csv(log_folder, csv_files):
log_0_csvs = []
log_1_csvs = []
new_csv_paths = []
with open(f"{log_folder}/{csv_files[0]}", "r") as f:
for line in f:
log_0_csvs.append(line.split(',')[0].strip())
with open(f"{log_folder}/{csv_files[1]}", "r") as f:
for line in f:
log_1_csvs.append(line.split(',')[0].strip())
for csv in log_1_csvs:
if csv not in log_0_csvs:
new_csv_paths.append(csv)
print(f"New CSV file: {csv}")
return new_csv_paths

def compare_csv_file_lists(log_folder, ds):
"""
Expand Down Expand Up @@ -36,6 +52,8 @@ def compare_csv_file_lists(log_folder, ds):

if cmp_out.stdout != "":
print("CSV files have changed!")
new_csv_paths = get_new_csv(log_folder, csv_files)
print(f"New CSV files: {new_csv_paths}")
else:
print("CSV files are the same.")

Expand Down

0 comments on commit d0c0d58

Please sign in to comment.