Read files

mail@pastecode.io avatar
unknown
java
2 years ago
856 B
3
Indexable
Never
HashSet<String> nameFiles = new HashSet<>();

                File folderFiles = new File(config.getPathToDrw());
                if (folderFiles.exists()) {
                    File[] files = folderFiles.listFiles();
                    logger.info("Folder temp , num files : " + files.length);
                    for (File f : files) {
                        if(f!=null && f.getName()!=null){
                            String ext = org.apache.commons.io.FilenameUtils.getExtension(f.getAbsolutePath());
                            
                            if( !(ext.equalsIgnoreCase("CSV") || ext.equalsIgnoreCase("XML")) )
                                nameFiles.add(f.getName());
                        }
                        
                        System.out.println("File name : "+f.getName());
                    }
                }