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.
25 lines
768 B
25 lines
768 B
"""EasyEngine file utils core classes."""
|
|
import shutil
|
|
import os
|
|
|
|
|
|
class EEFileUtils():
|
|
"""Method to operate on files"""
|
|
def __init__():
|
|
pass
|
|
|
|
def remove(filelist):
|
|
for file in filelist:
|
|
if os.path.isfile(file):
|
|
print("Removing "+os.path.basename(file)+" ...")
|
|
os.remove(file)
|
|
print("Done")
|
|
if os.path.isdir(file):
|
|
try:
|
|
print("Removing "+os.path.basename(file)+" ...")
|
|
shutil.rmtree(file)
|
|
print("Done")
|
|
except shutil.Error as e:
|
|
print("Unable to remove file, [{err}]"
|
|
.format(err=str(e.reason)))
|
|
return False
|
|
|