[英]Move a file from a non-SMB location to a SMB location in Java
How do you move a file from a local non-SMB folder to a SMB location in the server?如何将文件从本地非 SMB 文件夹移动到服务器中的 SMB 位置?
Below code doesn't work, but it's something like this what I am after.下面的代码不起作用,但这就是我所追求的。 I am able to authenticate the smb location.
我能够验证 smb 位置。
String sourceFile="target/abc.xml";
String smbDestinationFile="sharePath/abc/smblocation/xyz.xml";
SmbFile sTargetFile = performAuthenticationAndChecks(destinationFile, domain, domainUsername,
domainPassword);
Files.move(Paths.get(sourceFile), (Path) sTargetFile);
I get this error:我收到此错误:
java.lang.ClassCastException: jcifs.smb1.smb1.SmbFile cannot be cast to java.nio.file.Path
You may be using an outdated library.您可能正在使用过时的库。 Look for maintained alternatives such as JFileServer or jNQ.
寻找维护的替代品,例如 JFileServer 或 jNQ。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.