1

I'd like to generate files and folders in a folder using Java. Prior to that, I'd like to know the filesystem I'm wrting to (e.g. ext3, ext4, NTFS,...). Is there a way to do that?

If not: is there a way to find out limits of the underlying filesystem? (e.g. ext3 does only allow 32000 INODEs per folder)

Edward
  • 4,453
  • 8
  • 44
  • 82
  • could this help? http://stackoverflow.com/questions/9441258/identify-file-system-format-of-a-disk-type-in-java-like-ntfs-fat16-32-or-ext – SpaceCowboy Jul 01 '15 at 15:45
  • @Edward I haven't tried this my self but looks like the answer may lie in the [FileSystems](http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html) class added to JDK7 – Chetan Kinger Jul 01 '15 at 15:51
  • 1
    You can do that by using `.getFileSystem()` on a `Path` then playing with this filesystem's `.getFileStores()` and `.getRootDirectories()`; however this remains a heuristic... THe fact is that a `FileStore`'s `type()`, at least under Linux, returns the filesystem type, and the `name()` _may_ contain the mount point. – fge Jul 01 '15 at 15:53
  • @fge got it wrong..deleting my ans.Thanks – KDP Jul 01 '15 at 15:56
  • @fge can you write an answer from your comment; I'd like to accept it. – Edward Jul 08 '15 at 09:46

0 Answers0