org.apache.commons.io.filefilter.NotFileFilter Java Examples

The following examples show how to use org.apache.commons.io.filefilter.NotFileFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestNc4JniReadCompare.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Parameterized.Parameters(name = "{0}")
public static List<Object[]> getTestParameters() {

  FileFilter ff = new NotFileFilter(new SuffixFileFilter(".cdl"));
  List<Object[]> result = new ArrayList<Object[]>(500);
  try {
    TestDir.actOnAllParameterized(TestDir.cdmUnitTestDir + "formats/netcdf3/", ff, result);
    TestDir.actOnAllParameterized(TestDir.cdmUnitTestDir + "formats/netcdf4/", ff, result);
  } catch (IOException e) {
    e.printStackTrace();
  }

  return result;
}
 
Example #2
Source File: MavenRepositoryDeployer.java    From maven-repository-tools with Eclipse Public License 1.0 5 votes vote down vote up
public static Collection<File> getPomFiles( File repoPath )
{
    Collection<File> pomFiles = new ArrayList<File>();
    Collection<File> leafDirectories = getLeafDirectories( repoPath );
    for ( File leafDirectory : leafDirectories )
    {
        IOFileFilter fileFilter = new AndFileFilter( new WildcardFileFilter( "*.pom" ),
                                           new NotFileFilter( new SuffixFileFilter( "sha1" ) ) );
        pomFiles.addAll( FileUtils.listFiles( leafDirectory, fileFilter, null ) );
    }
    return pomFiles;
}
 
Example #3
Source File: RMFileUtils.java    From repositoryminer with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves all the sub directories from a root directory.
 * 
 * @param path
 *            the root path.
 * @return the sub directories.
 */
public static List<String> getAllDirsAsString(String path) {
	List<File> dirs = (List<File>) FileUtils.listFilesAndDirs(new File(path), new NotFileFilter(TrueFileFilter.INSTANCE),
			DirectoryFileFilter.DIRECTORY);
	List<String> dirsNames = new ArrayList<>();
	
	for (File f : dirs) {
		dirsNames.add(f.getAbsolutePath());
	}
	return dirsNames;
}
 
Example #4
Source File: TestNcmlWriteAndCompareShared.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Parameterized.Parameters(name = "{0}")
public static List<Object[]> getTestParameters() {
  String datadir = TestDir.cdmUnitTestDir;

  List<Object[]> result = new ArrayList<>(500);

  // result.add(new Object[]{datadir + "formats/netcdf4/tst/test_enum_type.nc", false});
  result.add(new Object[] {datadir + "conventions/atd-radar/rgg.20020411.000000.lel.ll.nc", false});
  result.add(new Object[] {datadir + "conventions/atd-radar/SPOL_3Volumes.nc", false});
  result.add(new Object[] {datadir + "conventions/awips/19981109_1200.nc", false});
  result.add(new Object[] {datadir + "conventions/cf/ccsm2.nc", false}); //
  result.add(new Object[] {datadir + "conventions/coards/cldc.mean.nc", false});
  result.add(new Object[] {datadir + "conventions/csm/o3monthly.nc", false});
  result.add(new Object[] {datadir + "conventions/gdv/OceanDJF.nc", false});
  result.add(new Object[] {datadir + "conventions/gief/coamps.wind_uv.nc", false});
  result.add(new Object[] {datadir + "conventions/mars/temp_air_01082000.nc", true});
  result.add(new Object[] {datadir + "conventions/nuwg/eta.nc", false});
  result.add(new Object[] {datadir + "conventions/nuwg/ocean.nc", true});
  result.add(new Object[] {datadir + "conventions/wrf/wrfout_v2_Lambert.nc", false});

  result.add(new Object[] {datadir + "formats/grib2/eta2.wmo", false}); //
  result.add(new Object[] {datadir + "formats/grib2/ndfd.wmo", false}); //

  result.add(new Object[] {datadir + "formats/gini/n0r_20041013_1852-compress", false}); //
  result.add(new Object[] {datadir + "formats/gini/ntp_20041206_2154", true}); //
  result.add(new Object[] {datadir + "formats/dmsp/F14200307192230.n.OIS", false}); //

  result.add(new Object[] {datadir + "formats/nexrad/level2/6500KHGX20000610_000110", false});
  result.add(new Object[] {datadir + "formats/nexrad/level2/Level2_KYUX_20060527_2335.ar2v", true});

  result.add(new Object[] {datadir + "conventions/nuwg/ocean.nc", true});

  // try everything from these directories
  try {
    addFromScan(result, TestDir.cdmUnitTestDir + "formats/netcdf4/",
        new NotFileFilter(new SuffixFileFilter(new String[] {".cdl", ".nc5", ".gbx9"})), false);
  } catch (IOException e) {
    e.printStackTrace();
  }

  return result;
}
 
Example #5
Source File: CommonUtils.java    From torrssen2 with MIT License 4 votes vote down vote up
public static List<String> removeDirectory(String path, String outer, SettingRepository settingRepository) {
    String[] exts = {};
    Optional<Setting> exceptExtSetting = settingRepository.findByKey("EXCEPT_EXT");
    if(exceptExtSetting.isPresent()) {
        exts = StringUtils.split(StringUtils.lowerCase(exceptExtSetting.get().getValue()), ",");
    }

    Optional<Setting> delDirSetting = settingRepository.findByKey("DEL_DIR");
    
    if (delDirSetting.isPresent()) {
        if(Boolean.parseBoolean(delDirSetting.get().getValue())) {
            File file = new File(path, outer);
            if (file.isDirectory()) {
                Collection<File> subFiles;
                if(exts != null) {
                    NotFileFilter fileFilter = new NotFileFilter(new SuffixFileFilter(exts)); 
                    subFiles = FileUtils.listFiles(new File(path, outer), fileFilter, TrueFileFilter.INSTANCE);
                } else {
                    subFiles = FileUtils.listFiles(new File(path, outer), TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
                }
                
                List<String> ret = new ArrayList<>();

                try {
                    for(File subFile: subFiles) {
                        log.debug(subFile.getPath() + ":" + subFile.getName());
                        File remove = new File(path, subFile.getName());
                        if (remove.isFile()) {
                            FileUtils.forceDelete(remove);
                        }
                        FileUtils.moveFileToDirectory(subFile, new File(path), true);
                        ret.add(subFile.getName());
                    }
                    FileUtils.forceDelete(new File(path, outer));
                } catch (IOException e) {
                    log.error(e.getMessage());
                }

                return ret;
            } 
        }
    }

    return null;
}
 
Example #6
Source File: HsacFitNesseRunner.java    From hsac-fitnesse-fixtures with Apache License 2.0 4 votes vote down vote up
protected FileFilter getFileSectionCopyFilter(Class<?> suiteClass) {
    List<String> excludes = getFileSectionCopyExcludes(suiteClass);
    List<IOFileFilter> excludeFilters = new ArrayList<>(excludes.size());
    excludes.forEach(x -> excludeFilters.add(new WildcardFileFilter(x)));
    return new NotFileFilter(new OrFileFilter(excludeFilters));
}
 
Example #7
Source File: RMFileUtils.java    From repositoryminer with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves all the sub directories from a root directory.
 * 
 * @param path
 *            the root path.
 * @return the sub directories.
 */
public static List<File> getAllDirs(String path) {
	return (List<File>) FileUtils.listFilesAndDirs(new File(path), new NotFileFilter(TrueFileFilter.INSTANCE),
			DirectoryFileFilter.DIRECTORY);
}