This discussion is archived
8 Replies Latest reply: Nov 21, 2012 2:25 AM by 800381 RSS

Get hard disk letter (C:\ or D:\) only from the path

Ravi_Teja Newbie
Currently Being Moderated
I have a requirement in my project to display only hard disk letter (C:\ or D:\) even when the user selects the directory/files inside the disk.
This need to work on both Windows and MAC OS. Is there a way to achieve this in Java?

E.g. If the user selected D:\Test\Test1 then we need to get only D:\


  • Correct Answers - 10 points
  • Helpful Answers - 5 points