我需要改变我的本地地址为UNC格式存储在像格式的地址开始:更改本地地址与地址UNC格式从共享文件夹
计算机名或服务器名称/共享文件夹名称和相关路径/文件名
对于实例如果本地计算机上地址是
D:\Workspace\Task Management System\TBMS\src\com\common\dao\fileName.xls
和common
是共享然后夹所需的地址应该像
ashish:\common\dao\filename.xls
其中ashish
是我计算机名
确实的Java提供了一些API或类可以实现这样的转换种类,或者是有一些通过我可以做到这一点的方法?
通过网络共享我得到了所有共享文件夹的名称。我无法获得唯一的共享名称文件夹吗?
我的代码是:
String line = null;
String[] commands = new String[] { "cmd", "/C", "net share" };
Process child = Runtime.getRuntime().exec(commands);
InputStream ins = child.getInputStream();
BufferedReader buffReader = new BufferedReader(new InputStreamReader(ins));
while (!(line = buffReader.readLine()).trim().equals("The command completed successfully."))
{
System.out.println(line);
}
有一些方法可以得到只有我的共享文件夹的详细信息,而不是默认文件夹?
** ashish:\ common \ dao \ filename.xls **不是UNC格式,是吗? –
它是lyk \\ ashish \ common \ dao \ filename.xls UNC我们有\\ server \ share \ file_path – user1029211