title: How to copy file from smb share to local drive using jcifs in Java?
body: <p>Could anybody help me to copy file from shared folder to local drive? My code is:</p>
  
  <pre><code>import jcifs.smb.NtlmPasswordAuthentication;
  import jcifs.smb.SmbFile;
  import jcifs.smb.SmbFileInputStream;
  import jcifs.smb.SmbFileOutputStream;;
  
  
  public class smb {
  
        /**
        * @param args
        * @throws IOException
         */
        public static void main(String[] args) throws IOException {
              // TODO Auto-generated method stub
  
  
            String urlToBackUpFile = "smb://ip/backup$/test.txt"; 
            System.out.println("smb folder of source file" + urlToBackUpFile);
            NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "login", "pass");
  
  
              SmbFile dir = new SmbFile(urlToBackUpFile, auth);
              System.out.println(dir.getDate());
              SmbFile dest = new SmbFile ("C:/SQLRESTORESTAGE/v2.bak");
              dir.copyTo(dest);
        }
  }
  </code></pre>
  
  <p>File file is not copied. I received a message "Failed to connect to server", but the programm shows dir.getDate() (and file name, and lenght) of source file. So I think the problem with destination folder (C:/SQLRESTORESTAGE/). Also I have proviledges only for reading source file. Could you help me to cirrect the code or advise something? Thank you.</p>