dicom-extractor-2023/drives.py

20 lines
406 B
Python
Raw Permalink Normal View History

2023-10-12 14:23:35 +02:00
from ctypes import windll
from string import ascii_uppercase
class Drives:
def __init__(self):
self.list = self.getDrives()
@staticmethod
def getDrives():
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
return drives