private static List<Path> getAllFilePaths(final FileSystem fs, Path path, final PathFilter filter) throws IOException {
        final List<Path> paths = new ArrayList<Path>();

        if (fs.isFile(path)) {
            paths.add(path);
        } else {
            for (final FileStatus status : fs.globStatus(new Path(path, "*"), filter)) {
                paths.addAll(getAllFilePaths(fs, status.getPath(), filter));
            }
        }
        return paths;
    }
@param pattern refers directory or a set of files
@return a non-null array of the files and directories the pattern refers as of {@link Storage#ls(String)}
hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/FileSystemStorage.java