Androi批量删除SD卡某个文件夹上的文件代码实现

public static void deleteAllFile(){

    String path = Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"文件夹名称";

       deleteFile(new File(path));

     }

   

       public static void deleteFile(File oldPath) {

              if (oldPath.isDirectory()) {

                     File[] files = oldPath.listFiles();

                     for (File file : files) {

                            deleteFile(file);

                            file.delete();

                     }

              }else{

                     oldPath.delete();

              }

       }

你可能感兴趣的:(android技术,android,删除文件)