寻找目录和子目录下面指定后缀的文件
@param dir 根目录
@param suffix 后缀
@return
357924
public static final Set<File> findFileByDirAndSubBySuffix(File dir,String ...suffix)
	{
		return findFileByDirAndSub(dir,new FileFilter() {
			@Override
			public boolean accept(File pathname) 
				{
					if(pathname.isDirectory())
					{
						return true;
					}
					if(pathname.isFile())
					{
						for(String s:suffix)
						{
							if(pathname.getName().endsWith(s))
							{
								return true;
							}
						}
					}
					return false;
				}
			});
	}
284463
String concatIndentAndDirectoryName(String indent, File directory) {

    indent = Optional.ofNullable(indent).filter(StringUtils::hasText)
      .map(it -> it + SUB_DIRECTORY_DASH_PLUS_OFFSET)
      .orElse(StringUtils.EMPTY_STRING);

    return String.format(indent + DIRECTORY_MARKER_WITH_DIRECTORY_NAME, directory.getName());
  }
392323
def walk_dir_with_filter(pth, prefix=None, suffix=None):
    
    if suffix is None or type(suffix) != list:
        suffix = []
    if prefix is None or type(prefix) != list:
        prefix = []

    r = []
    for root_, dirs, files in os.walk(pth):
        for file_ in files:
            full_pth = os.path.join(root_, file_)

            # 排除 \.开头文件, 及 .pyc .md 结尾文件
            c = False
            for x in prefix:
                if file_.startswith(x):
                    c = True
                    break
            if c:
                continue
            # if runs here , c is False
            for x in suffix:
                if file_.endswith(x):
                    c = True
                    break
            if c:
                continue

            r.append(full_pth)
    return r
837900
public static Props loadPropsInDirs(final List<File> dirs, final String... suffixes) {
    final Props props = new Props();
    for (final File dir : dirs) {
      props.putLocal(loadPropsInDir(dir, suffixes));
    }
    return props;
  }
357592
private List<String> getSchemaStringsFromDir(File dir) {
    List<String> schemaStrings = new ArrayList<String>();
    Collection<File> schemaFiles = FileUtils.listFiles(dir,
        new SuffixFileFilter(".avsc"), TrueFileFilter.INSTANCE);
    for (File schemaFile : schemaFiles) {
      schemaStrings.add(getSchemaStringFromFile(schemaFile));
    }
    return schemaStrings;
  }
734433
public static void deleteDir(Path dir) throws IOException {
		Validate.isTrue(isDirExists(dir), "%s is not exist or not a dir", dir);

		// 后序遍历，先删掉子目录中的文件/目录
		Files.walkFileTree(dir, deleteFileVisitor);
	}
1654
public static final List<String> listProjectNames(File directory)
   {
      List<String> result = new ArrayList<String>();

      File[] files = directory.listFiles(new FilenameFilter()
      {
         @Override public boolean accept(File dir, String name)
         {
            return name.toUpperCase().endsWith("STR.P3");
         }
      });

      if (files != null)
      {
         for (File file : files)
         {
            String fileName = file.getName();
            String prefix = fileName.substring(0, fileName.length() - 6);
            result.add(prefix);
         }
      }

      Collections.sort(result);

      return result;
   }
28331
public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException {
		int exceptionsCount = 0;
		while (true) {
			try {
				File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile();
				if (isReCreat) {
					file.delete();
					file.createNewFile();
				}
				return file;
			} catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied
				if (++exceptionsCount >= 50) {
					throw new IORuntimeException(ioex);
				}
			}
		}
	}
1360093
public Set getAllDirectoriesBelow(File dir) {
        Set allDirectories = new HashSet();
        if (dir.isDirectory()) {
            primGetAllDirectoriesBelow(dir, allDirectories);
        }
        return allDirectories;
    }
692551
public Launcher dir(File dir, String encoding) {
        this.builder.directory(dir);
        this.encoding = encoding;
        return this;
    }
357717
public static File [] getFilesWithPrefix(File dir, final String prefix) {
        FileFilter prefixFilter = new FileFilter() {
                public boolean accept(File pathname)
                {
                    return pathname.getName().toLowerCase().
                        startsWith(prefix.toLowerCase());
                }
            };
        return dir.listFiles(prefixFilter);
    }
221835
public static List<File> listFilesRecursively(File dir) {
		List<File> fileList = newArrayList();
		addFilesRecursively(dir, fileList);
		return fileList;
	}
531861
public static SwapFile createTempFile(String prefix, String suffix, File directory) throws IOException
   {
      throw new IOException("Not applicable. Call get(File, String) method instead");
   }
779178
function (suffix) {
        var id = suffix ? this._id + '-' + suffix : this._id;

        if (!this._elmCache[id]) {
          this._elmCache[id] = $('#' + id)[0];
        }

        return this._elmCache[id];
      }
601869
public static Pair<Descriptor,Component> fromFilename(File directory, String name)
    {
        Pair<Descriptor,String> path = Descriptor.fromFilename(directory, name);

        // parse the component suffix
        Type type = Type.fromRepresentation(path.right);
        // build (or retrieve singleton for) the component object
        Component component;
        switch(type)
        {
            case DATA:              component = Component.DATA;                         break;
            case PRIMARY_INDEX:     component = Component.PRIMARY_INDEX;                break;
            case FILTER:            component = Component.FILTER;                       break;
            case COMPRESSION_INFO:  component = Component.COMPRESSION_INFO;             break;
            case STATS:             component = Component.STATS;                        break;
            case DIGEST:            component = Component.DIGEST;                       break;
            case CRC:               component = Component.CRC;                          break;
            case SUMMARY:           component = Component.SUMMARY;                      break;
            case TOC:               component = Component.TOC;                          break;
            case CUSTOM:            component = new Component(Type.CUSTOM, path.right); break;
            default:
                 throw new IllegalStateException();
        }

        return Pair.create(path.left, component);
    }
63729
public void addWatchDirectory(File dir, String extension) {
        extension = removeStartingDotIfPresent(extension);
        List<String> fileExtensions = new ArrayList<String>();
        if (extension != null && extension.length() > 0) {
            int i = extension.lastIndexOf('.');
            if(i > -1) {
                extension = extension.substring(i + 1);
            }
            fileExtensions.add(extension);
        }
        else {
            fileExtensions.add("*");
        }
        addWatchDirectory(dir, fileExtensions);
    }
891844
public Href path(final Object suffix) {
        return new Href(
            URI.create(
                new StringBuilder(
                    Href.TRAILING_SLASH.matcher(this.uri.toString())
                        .replaceAll("")
                )
                .append('/')
                .append(Href.encode(suffix.toString())).toString()
            ),
            this.params,
            this.fragment
        );
    }