Electrons_Ahoy Electrons_Ahoy - 2 years ago 134
Python Question

Is there a way to list all the available drive letters in python?

More or less what it says on the tin: is there an (easy) way in Python to list all the currently in-use drive letters in a windows system?

(My google-fu seems to have let me down on this one.)


Answer Source
import win32api

drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1]
print drives

Adapted from: http://www.faqts.com/knowledge_base/view.phtml/aid/4670

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download