<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to copy files from HDFS recursive to the local file system in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-copy-files-from-HDFS-recursive-to-the-local-file/m-p/235470#M197283</link>
    <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You are specifying /folder/*.jar. If you want the .jar files from one level deeper, you would specify /folder/*/*.jar.&lt;/P&gt;&lt;P&gt;Or, here is an alternative example.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;[hdfs@c2175-node4 stuff]$ hdfs dfs -find /tmp -name *.jar
/tmp/somefolder/y.jar
/tmp/x.jar
[hdfs@c2175-node4 stuff]$ for result in `hdfs dfs -find /tmp -name *.jar` ; do hdfs dfs -copyToLocal $result; done
[hdfs@c2175-node4 stuff]$ ls -al
-rw-r--r-- 1 hdfs hadoop &amp;nbsp;0 Mar &amp;nbsp;8 08:43 x.jar
-rw-r--r-- 1 hdfs hadoop &amp;nbsp;0 Mar &amp;nbsp;8 08:43 y.j&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Mar 2019 16:46:22 GMT</pubDate>
    <dc:creator>JonathanSneep</dc:creator>
    <dc:date>2019-03-08T16:46:22Z</dc:date>
    <item>
      <title>How to copy files from HDFS recursive to the local file system</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-copy-files-from-HDFS-recursive-to-the-local-file/m-p/235469#M197282</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;How we can copy recursive jar files from HDFS ( jar files are under sub folders ) to local folder?&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;export hdfs_folder=/app/lib export local_folder=/home/work_app&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;while under /app/lib we have the following sub folder with the jar files&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;/app/lib/folder_jar1
/app/lib/folder_jar2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Under each of above folder we have jar files&lt;/P&gt;&lt;P&gt;The following command , will copy only the jar files under &lt;EM&gt;/app/lib&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but not&lt;/STRONG&gt; the Jar files under the sub folders as &lt;EM&gt;/app/lib/folder_jar1&lt;/EM&gt; , &lt;EM&gt;/app/lib/folder_jar2&lt;/EM&gt; , Etc &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;hadoop fs -copyToLocal $hdfs_folder/*.jar $local_folder&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Mar 2019 00:42:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-copy-files-from-HDFS-recursive-to-the-local-file/m-p/235469#M197282</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-03-08T00:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy files from HDFS recursive to the local file system</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-copy-files-from-HDFS-recursive-to-the-local-file/m-p/235470#M197283</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You are specifying /folder/*.jar. If you want the .jar files from one level deeper, you would specify /folder/*/*.jar.&lt;/P&gt;&lt;P&gt;Or, here is an alternative example.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;[hdfs@c2175-node4 stuff]$ hdfs dfs -find /tmp -name *.jar
/tmp/somefolder/y.jar
/tmp/x.jar
[hdfs@c2175-node4 stuff]$ for result in `hdfs dfs -find /tmp -name *.jar` ; do hdfs dfs -copyToLocal $result; done
[hdfs@c2175-node4 stuff]$ ls -al
-rw-r--r-- 1 hdfs hadoop &amp;nbsp;0 Mar &amp;nbsp;8 08:43 x.jar
-rw-r--r-- 1 hdfs hadoop &amp;nbsp;0 Mar &amp;nbsp;8 08:43 y.j&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Mar 2019 16:46:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-copy-files-from-HDFS-recursive-to-the-local-file/m-p/235470#M197283</guid>
      <dc:creator>JonathanSneep</dc:creator>
      <dc:date>2019-03-08T16:46:22Z</dc:date>
    </item>
  </channel>
</rss>

