From 81e9bcfa56d6307070a09af9afcc2d62d010a17e Mon Sep 17 00:00:00 2001 From: vangef Date: Mon, 16 Jan 2023 18:04:09 +0000 Subject: [PATCH] rename remaining files before moving/organising - use the original file name without the BB added info --- utils/organiser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/organiser.py b/utils/organiser.py index 9527603..9d183fe 100644 --- a/utils/organiser.py +++ b/utils/organiser.py @@ -73,7 +73,8 @@ def organise_file_per_student(src_dir, dest_dir, file_name, student_no): comments_filename = f'{dest_dir}_comments.txt' with open(comments_filename, 'a') as f: f.write(f'\nStudent number: {student_no} - File: {file_path}\nComment: {comment}\n') - + else: + file_name = file_name.split('_attempt_')[1].split('_', 1)[1] # rename any remaining files before moving - remove the BB generated info added to the original file name new_file_path = os.path.join(student_dir, os.path.basename(file_name)) shutil.move(file_path, new_file_path) # move the file to student directory