How to count the number of files in a folder in external storage?

android

Solution

Try this,and replace yourfolder with your actual folder name

File dir = new File(Environment.getExternalStorageDirectory() + "/yourfolder");
File[] files = dir.listFiles();
if (files != null) {
   int numberOfFiles = files.length;
}

Problem

I wanted to know the count of my downloaded files in a folder saved in my external strorage

Original source