Results 1 to 6 of 6

Thread: How to list the network drive

  1. #1
    Join Date
    Dec 2009
    Posts
    213

    How to list the network drive

    Hello everyone,
    Do you have any equivalent method for it. I am trying to list the network drivers of the system.
    Code:
    File[] File.listRoots()
    But for readers the list to add them in a JTree.
    Last edited by Aaliya Seth; 23-01-2010 at 12:25 PM.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: How to list the network drive

    Hi,
    The method listRoot () returns all drives but not the shared directory (I think it should include that in this case). You can use it for the method with getRoot FileSystemView of you who referred to the whole system. By this method you can view all the shared folders and the directories of the system.

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to list the network drive

    Hello,
    Here is some information about the listroot() method.
    public static File [] listRoots () List the available filesystem roots. A particular Java platform may support zero or more hierarchically-organized file systems. Each file system has a root directory Which from all other files in that file system can be reached. Windows platforms, for example, have a root directory for each active drive; UNIX platforms have a single root directory, namely "/". The set of available filesystem roots is affected by various system-level operations such the insertion or ejection of removable media and the disconnecting or unmounting of physical or virtual disk drives.

  4. #4
    Join Date
    Dec 2009
    Posts
    213

    Re: How to list the network drive

    Hello,
    Ok, so for FileSystemView when I try to instantiate I get an error, I do not why and what that errors means
    Can not instantiate the type FileSystemView
    Does this method work, and does this method displays all the files and the directories of the system. If so, then how to use this method, I have no idea about it and when I am trying it I am getting an error.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to list the network drive

    Hello,
    I think you are not clear with the basic of the java, I think you shoudl just go through the basics of the java first. Yes, it is a singleton you can not instantiate, that is why you are getting an error when you are trying to run your code.
    FileSystemView FSV = FileSystemView.getFileSystemView();
    Follow the above syntax and you can run your code successfully.

  6. #6
    Join Date
    Dec 2009
    Posts
    213

    Re: How to list the network drive

    Hi,
    So, the getRoot () return the directory or the files
    c: \ doc\ usr \ Desktop
    I am trying on this path, to get the files and the directories, but I am getting an error while running the program, so if there is alternative for this, that is any other method for this, then please do post back.

Similar Threads

  1. Replies: 13
    Last Post: 11-05-2012, 10:48 AM
  2. List of users connected to my network drive
    By Hobson in forum Networking & Security
    Replies: 1
    Last Post: 24-01-2012, 12:15 AM
  3. Replies: 5
    Last Post: 17-01-2011, 10:14 PM
  4. See a list of ips on a network
    By Jagriti in forum Networking & Security
    Replies: 3
    Last Post: 22-07-2009, 07:48 PM
  5. List of network commands
    By kex in forum Networking & Security
    Replies: 1
    Last Post: 23-09-2008, 04:32 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,882,975.17948 seconds with 17 queries