Accessing client's directory struture
1 posts in topic
Flat View  Flat View

Posted By:   john_varghese
Posted On:   Tuesday, October 15, 2002 11:38 PM

I am working on a web enabled application.

I want to access and list the directory structure of client
on the browser.

Listing is not a problem as I can use class JTree.

But how to access the filesystem.

I am using jSp and JavaBeans

Expecting a reply.
John Varghese

Re: Accessing client's directory struture

Posted By:   Muhammad_Murad  
Posted On:   Wednesday, October 16, 2002 12:14 AM

If you are talking about Windows, you cannot access the client's directory until and unless it is shared. Still, if you want, you cannot access the whole directory structure until the root is shared. only the subfolders and files of a particular shared folder are accessible for you.

Now consider you get access to a shared folder under Windows. You are now required to create a File object to point to the shared folder For example :

File remoteFile = new File("pcname\shared_folder_name");

Now you can create an array of Files(which can contain both files and folders for Java), and then access the subfolders or files under that shared folder. If you want to get the names of the subfolders and files under the shared folder, you can use the following method.

File[] list = f.listFiles();

feel free to ask more. Regards.

About | Sitemap | Contact