title: Word count program with two input files and single output file
body: <p>I am new to Hadoop. I have done word count program with single input file and single output file. Now I want to take 2 files as input and write that output to a single file. I tried like this: </p>
  
  <pre><code>FileInputFormat.setInputPaths(conf, new Path(args[0]), new Path(args[1]));
  FileOutputFormat.setOutputPath(conf, new Path(args[2]));
  </code></pre>
  
  <p>This is the command in terminal:</p>
  
  <pre><code>hadoop jar test.jar Driver /user/in.txt /user/sample.txt /user/out
  </code></pre>
  
  <p>When I run this, its taking sample.txt as output directory and says that :</p>
  
  <pre><code>Output directory hdfs://localhost:9000/user/sample.txt already exists
  </code></pre>
  
  <p>Can anyone help me with this?</p>