I am trying to use org.apache.commons.io.FileSystemUtils.freeSpaceKb(String path)
in Java to get the free space of a UNC path that has white spaces. The problem is that this function does not work properly when there are white spaces.
Say there is a computer in the network called John-PC. John has a shared folder that has white spaces, and we want to store something on that folder. But first, we want to make sure that he has enough space on his local drive. So we use freeSpaceKb(String path)
to get the free space available. If the path was like this it would have worked:
\\\john-pc\data\abc
But if we have white spaces in the path it does not work anymore.
\\\john-pc\data\abc def
I would really appreciate it if anyone would give me a good way of doing this.