Results 1 to 4 of 4

Thread: Finding all the drives through Java

  1. #1
    Join Date
    Nov 2009
    Posts
    57

    Finding all the drives through Java

    I want to know is there any way to list all local drives using java program. I want to create a software and in that I want a list of all local drivers so that I can click on it and select it. Please send me code that find all local drives.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Finding all the drives through Java

    I think this code give you list of all drives-

    Code:
          File []drives = new File("").listRoots();
       
          for(int m=0;j<drives.length;m++)
      
          System.out.println(drives[m]);

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Finding all the drives through Java

    Code:
          for(File drive : File.listRoots() )
    
          System.out.println(drive);
    This is a most easiest code to find all drives.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Finding all the drives through Java

    Code:
        File[] roots = File.listRoots();
        for(int p=0;p<roots.length;p++)
        System.out.println("Root["+p+"]:" + roots[p]);
        System.out.println(drives[p]);
    It will help you.

Similar Threads

  1. Need help finding drivers for IBM
    By Quinn28 in forum Operating Systems
    Replies: 1
    Last Post: 14-12-2011, 05:51 PM
  2. Eset NOD32 lock sata drives while using external drives
    By Ecchumati in forum Networking & Security
    Replies: 9
    Last Post: 24-11-2011, 02:13 PM
  3. Replies: 1
    Last Post: 30-09-2011, 12:00 PM
  4. Need help finding a UPS for my current rig
    By Danvir in forum Hardware Peripherals
    Replies: 5
    Last Post: 21-11-2010, 02:28 AM
  5. Replies: 3
    Last Post: 16-10-2010, 10:22 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,861,109.60317 seconds with 17 queries