首页 > 代码库 > 删除sd卡的文件

删除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();

              }

       }

删除sd卡的文件