in mtrl/replay_buffer.py [0:0]
def delete_from_filesystem(self, dir_to_delete_from: str):
for filename in os.listdir(dir_to_delete_from):
file_path = os.path.join(dir_to_delete_from, filename)
try:
if os.path.isfile(file_path) or os.path.islink(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
print(f"Deleted {file_path}")
except Exception as e:
print(f"Failed to delete {file_path}. Reason: {e}")
print(f"Deleted files from: {dir_to_delete_from}")