2015年5月10日 星期日

[Android] file delete


//remove past thumbnail
String del_path = Environment.getExternalStorageDirectory() + "/Download/IPCam/"+camIDArr[camIndex]+"/thumbnail/";
File dir = new File(del_path); 
Log.e("Environment.getExternalStorageDirectory()+del_path",del_path);
if (dir.isDirectory()) {
 String[] children = dir.list();
 
 for (int i = 0; i < children.length; i++) {
  Log.e("^^^^^^^^^=====>  children["+i+"]",children[i]);
  File imgFile = new  File(del_path+children[i]);
  if(imgFile.exists()){
   new File(dir, children[i]).delete();
  }
 } 
} 

沒有留言:

張貼留言