I'm trying to get the map between disk volume and drive in python but failed in any SO thread. It's quite easy to implement it in java, as the sample below:
import java.io.File;
import javax.swing.filechooser.FileSystemView;
public class Test{
public void listMap(){
File[] files = File.listRoots();
System.out.println("The map between volume label and drive is: " );
for(File file: files){
String theMap = FileSystemView.getFileSystemView().getSystemDisplayName(file);
System.out.println(theMap);
}
}
public static void main(String[] args) {
Test test = new Test();
test.listMap();
}
}
The map between volume label and drive is:
2008x64 (C:)
FlashDisk (E:)
If the map is there, it's quite easy to get drive "C:" based on the volume label "(2008x64)" and vice versa.
Thanks for your help in advance.