get number of files in a directory and its subdirectories

后端 未结 12 871
猫巷女王i
猫巷女王i 2020-12-28 09:19

using this code

new File(\"/mnt/sdcard/folder\").listFiles().length

returns a sum of folders and files in a particular directory without ca

12条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-28 10:02

    you will have to do a recursive search over your files. Use `File#isDrirectory()´ to check if a file is a directory and traverse the file tree down.

提交回复
热议问题