title: Java code to copy files from one linux machine to another linux machine
body: <p>I wants to write a program to copy/create one file from linux machine to another linux/windows machine in java.
  I tried below code,which will create one file in another windows machine..</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  
  public class Example2 {
  
      public static void main(String[] args) {
           String path = "\\\\10.15.0.166"+File.separator+"test";          
  
              String fname= path+File.separator+"Sample.pdf";
              File file = new File(fname);
              try {
                  file.createNewFile();
  
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              System.out.println("Exists"+file.exists());
              file.getParentFile().mkdirs();  
      }
  
  }
  </code></pre>
  
  <p>It worked in WIndows to windows.
  But when I tried from linux machine .it is creating folder in the linux machine itself.
  Could any one help me to solve this?</p>