Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrei-Claudiu Roibu
BrainMapper
Commits
018997a3
Commit
018997a3
authored
Apr 03, 2020
by
Andrei-Claudiu Roibu
🖥
Browse files
added a function to remove the contents of folders
parent
a1fc86c3
Changes
1
Show whitespace changes
Inline
Side-by-side
run.py
View file @
018997a3
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment