network shared folders...

B

Bumsys

How can I get shared folders of other computer in the network?

I do so:

public static String[] listSharedFolders(final String compName) {
ArrayList retValue = new ArrayList();
retValue.add("");
try {
File temp = File.createTempFile("N2AU", ".txt");
String filename = temp.getAbsolutePath();
String cmd = "cmd /c net view " + compName + " > " +
filename;
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();

BufferedReader bfr = new BufferedReader(new
FileReader(temp));
String text;
ArrayList lines = new ArrayList();
while ((text = bfr.readLine()) != null) {
lines.add(text);
}
bfr.close();
temp.delete();
ArrayList list = new ArrayList();
for (int i = 0; i < lines.size(); i++) {
String line = (String) lines.get(i);
StringTokenizer sttk = new StringTokenizer(line);
while (sttk.hasMoreTokens()) {
String comp = sttk.nextToken();
list.add(comp);
}
}
while (list.contains("Disk")) {
int index = list.indexOf("Disk");
retValue.add(list.get(index - 1));
list.remove(index);
}
} catch (IOException e) {
log.error("Error", e);
} catch (InterruptedException e) {
log.error("Error", e);
}
return (String[]) retValue.toArray(new String[] {});
}

But in various windows(english, russian, german) type of folders is
written various.
english: Disk
russian: äÉÓË
How can I get shared folder of other computer in the network?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top