You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
341 B
13 lines
341 B
5 years ago
|
import os
|
||
|
import shutil
|
||
|
|
||
|
|
||
|
def clearDir(rootdir):
|
||
|
filelist = os.listdir(rootdir)
|
||
|
for f in filelist:
|
||
|
filepath = os.path.join(rootdir, f)
|
||
|
if os.path.isfile(filepath):
|
||
|
os.remove(filepath)
|
||
|
print(filepath + " removed!")
|
||
|
elif os.path.isdir(filepath):
|
||
|
shutil.rmtree(filepath, True)
|