|
|
|
|
31
|
#
|
31
|
#
|
32
|
import subprocess
|
32
|
import subprocess
|
33
|
# typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
|
33
|
# typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
|
34
|
- driveStr = subprocess.check_output("fsutil fsinfo drives")
|
|
|
|
|
34
|
+ driveStr = subprocess.check_output("fsutil fsinfo drives").decode('utf8')
|
35
|
# typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
|
35
|
# typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
|
36
|
driveStr = driveStr.strip().lstrip('Drives: ')
|
36
|
driveStr = driveStr.strip().lstrip('Drives: ')
|
37
|
# typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\',
|
37
|
# typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\',
|
|
|
|
|
44
|
for drive in drives:
|
44
|
for drive in drives:
|
45
|
final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:'
|
45
|
final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:'
|
46
|
try:
|
46
|
try:
|
47
|
- volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT)
|
|
|
|
|
47
|
+ volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT).decode('utf8')
|
48
|
except Exception as e:
|
48
|
except Exception as e:
|
49
|
continue
|
49
|
continue
|
50
|
else:
|
50
|
else:
|