Skip to main content

How to get/list shared folder.

3 replies [Last post]
volt
Offline
Joined: 2007-11-07
Points: 0

Hi someone who knows how you can list shared folders on a remote computer.
e.g. all folders on 192.168.1.1

It's possible to list folder/files if I enter a shared folder on the remote computer.
File dir = new File("\\192.168.1.1\share");
File[] files = dir.listFiles();
Somehow this doesn't work
File dir = new File("\\192.168.1.1");
File[] files = dir.listFiles();

Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
peter__lawrey
Offline
Joined: 2005-11-01
Points: 0

Try this in the dos prompt.

cd \\192.168.254.1\
dir

tell us what you get?

BTW: \\ in Java means just \ as it is an escape character. \s doesn't mean anything.
Perhaps you meant

File dir = new File("\\\\192.168.1.1\\share");

amarnath_habib
Offline
Joined: 2006-05-05
Points: 0

when I tried the command:
I received below message:

CMD does not support UNC paths as current directories.

amarnath_habib
Offline
Joined: 2006-05-05
Points: 0

Volt,
Did you find any solution for this? I am also interested in knowing the solution for this. Can you help me, if you have been successfull in getting the list of folders shared on a network machine?