Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: HOw to find out FileSystem Information

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HOw to find out FileSystem Information

    Hello, i've a query its regarding FileSystem information

    FileSystemView fileSystemView = FileSystemView.getFileSystemView();
    System.out.println(" File system list of roots");
    File[] roots = File.listRoots();
    for (int j = 0; j < roots.length; j++) {
    long total = roots[j].getTotalSpace() / 1024;
    System.out.println(" Display name "
    + fileSystemView.getSystemDisplayName(roots[j]));
    System.out.println(" is drive " + fileSystemView.isDrive(roots[j]));
    System.out.println(" is floppy "
    + fileSystemView.isFloppyDrive(roots[j]));
    System.out.println(" is readable " + roots[j].canRead());
    System.out.println(" is writable " + roots[j].canWrite());
    System.out.println(" Total space " + roots[j].getTotalSpace());
    System.out.println(" Used Space " + roots[j].getUsableSpace());

    with this i was able to find out the information such as total sapce, available space, and name of the drives, but i want to know what is the filesystem the drive is working on like NTFS, FTS, CDFS ... etc

    any help is appreciated

    Thanks


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,541
    My Mood
    Hungover
    Thanks
    145
    Thanked 648 Times in 553 Posts

    Default Re: HOw to find out FileSystem Information

    Why do you want to know this? And don't you already get the name of the drives from the listRoots() functions?

    You might want to check out the System.getProperties() and related methods. No promises though, as things like what filesystem the computer has are at a lower level than Java typically cares about.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HOw to find out FileSystem Information

    I dont think there should be a reason to know some thing, anyways reason is i have some raw data, before i proceed to work on i have to check filesystem information where it present and all

    Secondly yes i tried with System.getProperties() and othe relative method but unfortunately i couldn't find any method

    Actually i wana know one thing Is it possible to find out the FileSystem info or not with java ?

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,541
    My Mood
    Hungover
    Thanks
    145
    Thanked 648 Times in 553 Posts

    Default Re: HOw to find out FileSystem Information

    The reason I asked why you want to know it is because most of the time, when you think you want to know about low-level stuff like this, there's a different approach you should be taking.

    Have you looked at the getAttribute() method of the FileStore class?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HOw to find out FileSystem Information

    @Kevin , Tried mate, dint work

    Any more class, which can provide file system info

Similar Threads

  1. Getting information from an array
    By andresfelquintero in forum Algorithms & Recursion
    Replies: 2
    Last Post: May 3rd, 2011, 05:53 PM
  2. I cannot get to print out all my information.
    By kl2eativ in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 25th, 2011, 01:46 PM
  3. can't get all the information out of my array at once... please help
    By Tate in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 28th, 2010, 06:22 AM
  4. Getting information from a folder
    By shadihrr in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: February 23rd, 2010, 04:13 PM
  5. Passing Information between classes
    By SKhoujinian91 in forum Object Oriented Programming
    Replies: 4
    Last Post: December 8th, 2009, 03:40 PM