Skip to content

Commit

Permalink
fix(ats): Ensure directory exists before attempting to remove old fil…
Browse files Browse the repository at this point in the history
…es (#290)

- Added a check to verify if the directory exists in  before attempting to list its contents.
- If the directory does not exist, it is created to prevent errors during file removal.

Co-authored-by: abdulkhalek <[email protected]>
  • Loading branch information
Abdulkhalek-1 and abdulkhalek authored Oct 22, 2024
1 parent 0b39f8c commit 973e367
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions run_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def read_json(filename):


def remove_old_files(files_path):
if not os.path.exists(files_path): # Check if the folder exists or not.
# Create the folder if it doesn't exist to avoid error in the next step.
os.makedirs(files_path)

for filename in os.listdir(files_path):
try:
Expand Down

0 comments on commit 973e367

Please sign in to comment.