import java.io.File;
 

public class Test12121 {
 

    /**
 
     * @param args
 
     */
 
    /**
 
     * 删除目录下一级的所有文件与目录
 
     * @param file
 
     */
 
    private void delTempFiles(File file,Test12121 biz) throws Exception{
 
        //if(file.isFile()) {
 
        //if(!file.delete()) {
 
          
 
            if(file.isFile()) {
 
                file.delete();
 
            } else {
 
                File[] files = file.listFiles();
 
                for(int i=0; i<files.length; i++) {
 
                    if(files[i].isDirectory()&&files[i].listFiles().length>0) {
 
                        biz.delTempFiles(files[i],biz);
 
                    } 
 
                    files[i].delete();
 
                }
 
            }
 
            
 
        //}
 
        /*if(file!=null) {
 
          file.delete();
 
        }*/
 
    }
 
    
 
    public static void main(String[] args) {
 
        System.out.println("1212");
 
        Test12121 biz = new Test12121();
 
        File f = new File("F:/dkdk");
 
        try {
 
            biz.delTempFiles(f,biz);
 
        } catch (Exception e) {
 
            // TODO Auto-generated catch block
 
            e.printStackTrace();
 
        }
 
    }
 

}