title: ListFiles() only shows folders but no files - AndroidStudio
body: <p>I need to iterate over a folder, going throughout all the files in it. However, It says that my folder is empty (size = 0). I did some more test and find out that .listFiles() was giving me only folders and not any files (by files I mean .txt, .png, .pdf etc)</p>
  <p>In the sample below, ImagesTeste has 6 .jpg images, but none of them are found by .listFiles()</p>
  <pre><code>            String path = Environment.getExternalStorageDirectory().toString()+&quot;/DCIM/ImagesTeste&quot;;
              Log.d(&quot;Files&quot;, &quot;Path: &quot; + path);
              File directory = new File(path);
              File[] files = directory.listFiles();
              Log.d(&quot;Files&quot;, &quot;Size: &quot;+ files.length);
  
              for (int i = 0; i &lt; files.length; i++)
              {
                  Log.d(&quot;Files&quot;, &quot;FileName:&quot; + files[i].getName());
  
                  }
  </code></pre>