title: get Root directory (i.e external or external sdcard) from file path
body: <p>I am facing a situation to calculate the free size of the currently selected primary memory(i.e external or external sdcard).
  All i have is the file path in app specific folder like below</p>
  
  <p>"/root/extsdcard/Android/data/com.a.b/files/img0001.jpg";</p>
  
  <p>or</p>
  
  <p>"/root/ext/Android/data/com.a.b/files/img0001.jpg";</p>
  
  <p>How i can get the path "/root/extsdcard/" or "/root/ext/" respectively from above shown paths?</p>