Commit 018997a3 authored by Andrei-Claudiu Roibu's avatar Andrei-Claudiu Roibu 🖥
Browse files

added a function to remove the contents of folders

parent a1fc86c3
......@@ -26,6 +26,7 @@ from solver import Solver
import os
from utils.data_logging_utils import LogWriter
import utils.data_evaluation_utils as evaluations
import shutil
# Set the default floating point tensor type to FloatTensor
......@@ -365,9 +366,30 @@ def evaluate_mapping(mapping_evaluation_parameters):
exit_on_error= exit_on_error)
def delete_files():
""" Function which clears contents (like experiments or logs)
""" Clear Folder Contents
Function which clears contents (like experiments or logs)
Args:
folder (str): Name of folders whose conents is to be deleted
Returns:
None
Raises:
Exception: Any error
"""
pass
for object_name in os.listdir(folder):
file_path = os.path.join(folder, object_name)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
except Exception as exception:
print(exception)
if __name__ == '__main__':
pass
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment