In java, you can use File.listRoots()
to get all drives in the system.
I'm looking to get only the external drives, i.e. USB drives, external hard disks, optical drives, floppy, etc.
Is there any way to do it in java? If not, native C++ code would be good as well. In that case, I need both Windows and Linux code.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…