Issue
I'm looking for a way to display system drives on mac os X in order to use a method that let me show variation of free space in drives due to future file deleting or copying.
I explain better:
if I would copy a 10 Mb File from an HD to an USB key 1GB initially empty I would like to show that new free space on USB key will be 1014Mb before copying the File.
In this way I can see if some operations would use more space than the available.
I know that the method length() let me see the dimension of a File and getFreeSpace() let me know how much free space is available, but I don't know how to get system root (method FileSystemView.getFileSystemView().getRoots() return an Array with only one File with path "/").
I'm working on mac os x, and I'm a mac newbie. All the methods that I use on windows doesn't work here.
I hope you'll understand (sorry for my English...)!
Solution
From terminal, type mount
. This will give you a list of the devices that are mounted. The valid names are to the right. For me, there is a card "Card" mounted in a card reader and I access that as /Volumes/Card
. So:
File f = new File("/Volumes/Card");
f.getFreeSpace().
would get the free space on the card. getting the list of names at /Volumes should let you see what is mounted, as well.
Answered By - Paul W