diff --git a/main.py b/main.py
index c6bb82cf51c66a773acca95f3394236bf34ac2de..3e7a36d772f1ec9ddbb5d53846772d24adba6121 100644
--- a/main.py
+++ b/main.py
@@ -95,8 +95,10 @@ def run_beta_reduction_totale(terme,path='beta_reduction_totale'):
     if save_image_choice == 'y':
         os.makedirs("./sauvegarde/"+path, exist_ok=True)
         moveImages(path,'./sauvegarde/'+path)
+        os.rmdir(path)
     elif save_image_choice == 'n':
         delete_images(path)
+        os.rmdir(path)
 
 def run_beta_reduction_interactive_totale(terme,path='beta_reduction_interactive_totale'):
     terme = parsing.parseTerm(terme)
@@ -110,8 +112,10 @@ def run_beta_reduction_interactive_totale(terme,path='beta_reduction_interactive
     if save_image_choice == 'y':
         os.makedirs("./sauvegarde/"+path, exist_ok=True)
         moveImages(path,'./sauvegarde/'+path)
+        os.rmdir(path)
     elif save_image_choice == 'n':
         delete_images(path)
+        os.rmdir(path)
 
 def run_show_numbers(path):
     os.makedirs(path, exist_ok=True)
@@ -133,8 +137,10 @@ def run_show_numbers(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
 
     elif choice==2:
         clear()
@@ -149,8 +155,10 @@ def run_show_numbers(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==3:
         run_main_menu()
 
@@ -173,8 +181,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==2:
         clear()
         t = app_functions.AND
@@ -186,8 +196,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==3:
         clear()
         t = app_functions.OR
@@ -199,8 +211,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice ==4:
         clear()
         t = app_functions.XOR
@@ -212,8 +226,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
 
     elif choice==5:
         clear()
@@ -226,8 +242,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==6:
         run_main_menu()
 
@@ -298,8 +316,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice == 2:
         clear()
@@ -311,8 +331,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice == 3:
         clear()
@@ -324,8 +346,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice==4:
         clear()
@@ -337,8 +361,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice==5:
         clear()
@@ -350,8 +376,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice==6:
         clear()
@@ -363,8 +391,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice == 7:
         clear()