2019-01-21 java删除文件

package dele;

import java.io.File;
import java.util.ArrayList;

public class aaa {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        String path = "C:\\Users\\Tse\\Desktop\\svg\\svgicon";
        String path2 = "C:\\Users\\Tse\\Desktop\\svg\\svg";
        ArrayList fileNameList = new ArrayList();
        getAllFileName(path,fileNameList);
        //System.out.println(fileNameList.get(0));

        //deleteFile(path2,fileNameList.get(0));

        for(int j=0; j fileNameList) {
        //ArrayList files = new ArrayList();
        boolean flag = false;
        File file = new File(path);
        File[] tempList = file.listFiles();

        for (int i = 0; i < tempList.length; i++) {
            if (tempList[i].isFile()) {
//              System.out.println("文     件:" + tempList[i]);
                //fileNameList.add(tempList[i].toString());
                fileNameList.add(tempList[i].getName());
            }
            if (tempList[i].isDirectory()) {
//              System.out.println("文件夹:" + tempList[i]);
                getAllFileName(tempList[i].getAbsolutePath(),fileNameList);
            }
        }
        return;
    }

}

你可能感兴趣的:(2019-01-21 java删除文件)