title: How to copy files from Hadoop cluster to local file system
body: <h2><strong>Setup:</strong></h2>
  
  <p>I have a map-reduce job. In the mapper class (which is obviously running on the cluster), I have a code something like this:</p>
  
  <pre><code>try {
  .
  .
  .
  } catch (&lt;some exception&gt;) {
      // Do some stuff
  }
  </code></pre>
  
  <h2><strong>What I want to change:</strong></h2>
  
  <p>In the catch{} clause, I want to copy the logs from the cluster to the local file system</p>
  
  <h2><strong>Problem:</strong></h2>
  
  <p>I can see the log file in the directory on the node if I check from command line. But when I try to copy it use org.apache.hadoop.fs.FileSystem.copyToLocalFile(boolean delSrc, Path src, Path dst), it says the file does not exist.</p>
  
  <p>Can anyone tell me what I am doing wrong? I am very new to Hadoop, so may be I am missing something obvious. Please ask ask me any clarifying questions, if needed, as I am not sure if I have given all the necessary inforation.</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT 1:</strong>: Since I am trying to copy files from cluster to local and the java code is also running on cluster, can I even use <code>copyToLocalFile()</code>? Or do I need to do a simple <code>scp</code>?</p>