Skip to content

Commit 27368d2

Browse files
author
Tim Walsh
committed
Account for exportall in analysis CSV generation
1 parent 44cf601 commit 27368d2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

diskimageanalyzer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def time_to_int(str_time):
4141
dt = time.mktime(datetime.datetime.strptime(str_time, "%Y-%m-%dT%H:%M:%S").timetuple())
4242
return dt
4343

44-
def write_to_spreadsheet(disk_result, spreadsheet_path):
44+
def write_to_spreadsheet(disk_result, spreadsheet_path, exportall):
4545
"""append info for current disk to analysis CSV"""
4646

4747
# open description spreadsheet
@@ -71,6 +71,12 @@ def write_to_spreadsheet(disk_result, spreadsheet_path):
7171
# skip directories and links
7272
if obj.name_type != "r":
7373
continue
74+
75+
# skip unallocated if args.exportall is False
76+
if exportall == False:
77+
if obj.unalloc:
78+
if obj.unalloc == 1:
79+
continue
7480

7581
# gather info
7682
number_files += 1
@@ -493,7 +499,7 @@ def write_to_spreadsheet(disk_result, spreadsheet_path):
493499
# add info to description spreadsheet
494500
for item in sorted(os.listdir(results_dir)):
495501
disk_result = os.path.join(results_dir, item)
496-
write_to_spreadsheet(disk_result, spreadsheet_path)
502+
write_to_spreadsheet(disk_result, spreadsheet_path, args.exportall)
497503

498504
# write closing message
499505
if unanalyzed:

0 commit comments

Comments
 (0)