I\'m trying to write little program which will be able to read some informations about REMOVEABLE_DEVICE (USB). I\'ve tried pyusb but I was not able to pull data I need.
I will look odd but it will work (get list of all removable volume's Label's
)
import os
os.system('echo list volume > Ravi.txt')
path1 = os.path.join(os.getcwd(),"Ravi.txt")
os.system('diskpart /s '+path1+' > logfile.txt')
path2 = os.path.join(os.getcwd(),"logfile.txt")
Str = open(path2).read()
Str = Str.split('\n')
matching = [s for s in Str if "Removable" in s]
for i in matching:
i = ' '.join(i.split())
i = i.split(" ")
print i[3]+"("+i[2]+":)"
output
MYPENDRIVE(D:)