title: Hive : How to execute a query from a file and dump the output in hdfs
body: <p>I can execute a query from a sql file and store the output in a local file using </p>
  
  <pre><code>hive -f /home/Prashasti/test.sql &gt; /home/Prashasti/output.csv
  </code></pre>
  
  <p>Also, I can store the output of a hive query in hdfs using :</p>
  
  <pre><code>insert overwrite directory 'user/output' select * from folders;
  </code></pre>
  
  <p>Is there any way I can run the query from a sql file and store the output in hdfs too?</p>