Java copy a folder excluding some internal file

前端 未结 4 692
故里飘歌
故里飘歌 2021-01-19 01:54

I have a folder with this structure

mainFolder

   --Sub1  
         --File .scl
         --File .awl
         --Other files
   --Sub2  
         --Fi         


        
4条回答
  •  既然无缘
    2021-01-19 02:21

    Is the case of those string fixed in stone? Maybe something like

    new FileFilter() {
        public boolean accept(File pathname) {
            String path = pathname.getAbsolutePath().toLowerCase();
    
            return (!pathname.isDirectory() || path.endsWith("sub3")) &&
                (!Settings.getSiemensOptionAWL() && path.endsWith(".awl")) &&
                (!Settings.getSiemensOptionSCL() && path.endsWith(".scl"));
        }
    }
    

提交回复
热议问题