How to copy file from smb share to local drive using jcifs in Java?

前端 未结 5 1717
后悔当初
后悔当初 2020-12-06 19:07

Could anybody help me to copy file from shared folder to local drive? My code is:

import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
impo         


        
5条回答
  •  醉话见心
    2020-12-06 19:47

    I got it to work. I had to 'create' the destination file before doing the copy. try adding the middle line below into your original code-snippet and see if that works.

    SmbFile dest = new SmbFile ("C:/SQLRESTORESTAGE/v2.bak");
    dest.createNewFile();
    dir.copyTo(dest);
    

提交回复
热议问题