Fix cleanup_d7ii()
This commit is contained in:
parent
122df6240c
commit
93e4bd5c0f
1 changed files with 10 additions and 8 deletions
|
|
@ -125,27 +125,29 @@ def cleanup_d7ii():
|
|||
prefix=KIT_NAME_SHORT,
|
||||
date=d7_date,
|
||||
**global_vars['Env'])
|
||||
os.makedirs(r'{}\d7II'.format(log_dest), exist_ok=True)
|
||||
os.makedirs(r'{}\Tools'.format(log_dest), exist_ok=True)
|
||||
|
||||
# Malware Logs
|
||||
if os.path.exists(d7_mlogs):
|
||||
m_report = 'MalwareScan_Report.txt'
|
||||
for m_entry in os.scandir(d7_mlogs):
|
||||
dest_path = r'{}\{}\{}'.format(
|
||||
log_dest,
|
||||
'd7II' if m_entry.name == m_report else 'Tools',
|
||||
m_entry.name)
|
||||
if m_entry.name == m_report:
|
||||
dest_path = r'{}\d7II\{}'.format(log_dest, m_entry.name)
|
||||
else:
|
||||
dest_path = r'{}\Tools\{}'.format(log_dest, m_entry.name)
|
||||
dest_path = non_clobber_rename(dest_path)
|
||||
shutil.move(entry.path, dest_path)
|
||||
shutil.move(m_entry.path, dest_path)
|
||||
|
||||
# Other items
|
||||
for o_entry in os.scandir(entry.path):
|
||||
dest_path = r'{log_dest}\d7II\{name}'.format(
|
||||
log_dest=log_dest,
|
||||
name=m_entry.name)
|
||||
name=o_entry.name)
|
||||
dest_path = non_clobber_rename(dest_path)
|
||||
|
||||
# Just remove empty folders
|
||||
if o_entry.isdir():
|
||||
if o_entry.is_dir():
|
||||
try:
|
||||
os.rmdir(o_entry.path)
|
||||
except OSError:
|
||||
|
|
@ -154,7 +156,7 @@ def cleanup_d7ii():
|
|||
continue
|
||||
|
||||
# Move item
|
||||
shutil.move(entry.path, dest_path)
|
||||
shutil.move(o_entry.path, dest_path)
|
||||
|
||||
# Remove folder
|
||||
delete_empty_folders(entry.path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue