Returns the resource names contained in a directory, and for directory
resource, a trailing '/' is added

@param dir
the directory
@return the resource names
504708
public static Set<String> getResourceNames(File dir) {

		Set<String> resourceNames = new HashSet<String>();

		// If the path is not valid throw an exception
		String[] resArray = dir.list();

		if (resArray != null) {
			// Make the returned dirs end with '/', to match a servletcontext
			// behavior.
			for (int i = 0; i < resArray.length; i++) {
				if (new File(dir, resArray[i]).isDirectory())
					resArray[i] += '/';
			}
			resourceNames.addAll(Arrays.asList(resArray));
		}
		return resourceNames;
	}
633300
public static List<File> findFilesWithFilter(final File dir, final String... extension)
	{
		final List<File> foundedFileList = new ArrayList<>();
		final File[] children = dir.listFiles(new MultiplyExtensionsFileFilter(true, extension));
		for (final File element : children)
		{
			// if the entry is a directory
			if (element.isDirectory())
			{ // then
				// find recursively in the directory and put it in a List.
				// Put the founded files in the main List.
				foundedFileList.addAll(findFilesWithFilter(element, extension));
			}
			else
			{
				foundedFileList.add(element.getAbsoluteFile());
			}
		}
		return foundedFileList;
	}
847198
public static final File[] findJarFileByDir(File dir)
	{
		if(dir==null)
		{
			throw new NullArgumentException("dir ==null");
		}
		if(dir.isFile())
		{
			throw new IllegalArgumentException("dir "+dir+" is not a dir");
		}
		if(!dir.exists())
		{
			throw new IllegalArgumentException("dir "+dir+" not found");
		}
		File[] jarFiles = dir.listFiles(new FileFilter() {
			@Override
			public boolean accept(File pathname) 
				{
					return pathname.getName().endsWith(".jar");
				}
			});
		return jarFiles;
	}
112456
public List<String> list(String folder) throws IOException {
      List<String> res = new ArrayList<String>();
      if (path != null) {
        File f = new File(Utilities.path(path, folder));
        if (f.exists() && f.isDirectory())
          for (String s : f.list())
            res.add(s);
      } else {
        for (String s : content.keySet()) {
          if (s.startsWith(folder+"/") && !s.substring(folder.length()+2).contains("/"))
            res.add(s.substring(folder.length()+1));
        }
      }
      return res;
    }
1161963
public static void checkValidDir(final File dir) {
        checkNotNull("dir", dir);
        if (!dir.exists()) {
            throw new IllegalArgumentException("The directory '" + dir + "' does not exist!");
        }
        if (!dir.isDirectory()) {
            throw new IllegalArgumentException("The name '" + dir + "' is not a directory!");
        }
    }
823089
def get_paths(directory):
    '''
    '''
    fnames = [os.path.join(directory, f)
              for f in os.listdir(directory)
              if os.path.isfile(os.path.join(directory, f))
              and not f.startswith('.')]
    return fnames
446480
public static List<File> findAllFiles(final File dir, final String fileSearchPattern)
	{
		final List<File> foundFiles = new ArrayList<>();
		// Get all files
		final File[] children = dir.getAbsoluteFile().listFiles();
		if (children == null || children.length < 1)
		{
			return foundFiles;
		}
		for (final File element : children)
		{
			// if the entry is a directory
			if (element.isDirectory())
			{ // then
				// find recursively in the directory and put it in a List.
				final List<File> foundedFiles = findAllFiles(element, fileSearchPattern);
				// Put the founded files in the main List.
				foundFiles.addAll(foundedFiles);
			}
			else
			{
				// entry is a file
				final String filename = element.getName();
				if (filename.matches(fileSearchPattern))
				{
					foundFiles.add(element.getAbsoluteFile());
				}
			}
		}
		return foundFiles;
	}
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);
    }
57509
public java.util.List<String> getResourceIds() {
        if (resourceIds == null) {
            resourceIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return resourceIds;
    }
187411
protected String getResourceSuffix(String target) {
        int index = target.lastIndexOf('/');
        if ( index > -1 ) {
            target = target.substring(index + 1);
        }
        return target;
    }
779750
function getResourceNames() {
        var resourceNames = {};
        var resourcesDir = this.injector.rootDir + '/' + this.injector.servicesDir + '/resources';

        if (!fs.existsSync(path.normalize(resourcesDir))) {
            return resourceNames;
        }

        var names = fs.readdirSync(path.normalize(resourcesDir));
        _.each(names, function (name) {
            if (name.substring(name.length - 3) !== '.js') {  // only dirs, not js files
                resourceNames[utils.getPascalCase(name)] = utils.getCamelCase(name);
            }
        });

        return resourceNames;
    }
564967
private static Collection<File> findDirsRecursively(File dir) {
		return FileUtils.listFilesAndDirs(dir, FalseFileFilter.FALSE, TrueFileFilter.TRUE);
	}
1188965
public static function directory_contents($dir)
    {
        $contents = array();
        foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS)) as $pathname => $fi) {
            $contents[] = $pathname;
        }
        natsort($contents);
        return $contents;
    }
434655
public File[] getAllFilesBelow(File dir) {
        Set allFiles = new HashSet();
        if (dir.isDirectory()) {
            primGetAllFilesBelow(dir, allFiles);
        }
        return (File[]) allFiles.toArray(new File[allFiles.size()]);
    }
1221189
public static void directoryCheck(String dir) throws IOException {
		final File file = new File(dir);

		if (!file.exists()) {
			FileUtils.forceMkdir(file);
		}
	}
234624
@Override
	public Set<String> getResourceNames(String path) {
		return ((WebJarsLocatorPathResolver)resolver).getResourceNames(path);
	}
409735
private List<File> getConfigFiles(File dir) {
		String[] extensions = { "xml" };
		List<File> configFiles = new ArrayList<File>();

		Collection<File> files = FileUtils.listFiles(dir, extensions, true);
		for (Iterator<File> iterator = files.iterator(); iterator.hasNext();) {
			File file = (File) iterator.next();
			if (file.getName().equals("config.xml")) {
				configFiles.add(file);
			}

		}
		return configFiles;
	}