Copy folder from Android app to local Windows directory
<p>I'm trying to use the <code>Android Adb Command Prompt</code> to copy a folder inside the app container to a local Windows folder. The device is running Android 5.1.1 and is <strong>not rooted</strong>.</p>

<p><code>adb pull</code> or <code>cp</code> aren't working. How can I copy a folder?</p>

<p>The following approaches aren't working:</p>

<p><strong>Approach 1</strong></p>

<pre><code>adb shell
adb pull /data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs C:/temp/test
</code></pre>

<blockquote>
  <p>error: device not found</p>
</blockquote>

<p>Inside the shell you can't see to do <code>adb pull</code>. See <a href="https://stackoverflow.com/a/31357066/426227">here</a>.</p>

<p><strong>Approach 2</strong></p>

<p>DDMS can't access the <code>data</code> folder.</p>

<p><strong>Approach 3</strong></p>

<pre><code>adb shell
run-as DroidSample.DroidSample
cp /files/MetroLog/MetroLogs/ C:/temp/test
</code></pre>

<blockquote>
  <p>cp: /files/MetroLog/MetroLogs/: No such file or directory</p>
</blockquote>

<p><strong>Approach 4</strong></p>

<pre><code>adb shell
run-as DroidSample.DroidSample
cp /data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs/ C:/temp/test
</code></pre>

<blockquote>
  <p>cp: /data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs is a directory (not copied).</p>
</blockquote>

<p><a href="https://stackoverflow.com/a/17876731/426227">This</a> is also not working.</p>

<p><strong>Approach 5</strong></p>

<pre><code>adb shell
run-as DroidSample.DroidSample
chmod 777 /files/MetroLog/MetroLogs
exit
exit
adb pull /data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs C:/temp/test
adb shell run-as DroidSample.DroidSample
chmod 700 /files/MetroLog/Metrologs
</code></pre>

<blockquote>
  <p>remote object '/data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs' does not exist</p>
</blockquote>

<p>So also <a href="https://stackoverflow.com/a/18472135/426227">this</a> isn't working.</p>

<p><strong>Approach 6</strong></p>

<pre><code>adb shell
mkdir /sdcard/tmp
cp /data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs /sdcard/tmp
</code></pre>

<blockquote>
  <p>cp: /data/data/DroidSample.DroidSample/files/MetroLog/MetroLogs: Permission denied</p>
</blockquote>

<p><a href="https://stackoverflow.com/a/8650449/426227">This</a> is also not working.</p>

<p><strong>Approach 7</strong></p>

<p>The only thing which half work is this</p>

<pre><code>adb exec-out run-as DroidSample.DroidSample cat "files/MetroLog/MetroLogs/Log - 20160509.log" &gt; C:/temp/test/test.log
</code></pre>

<p>But here I don't get the original file and I also have to know the exact file name. Additionally, that I loose line breaks and I have to do this for each file. Not that what I want.</p>

<p>So I'm running out of ideas. How can I access the internal stored files and copy them over?</p>