Get all log files and directories and make recursive call.

@param aStartingDir
@return
@throws Exception
480728
static private List<File> getFileListingLogs(File aStartingDir)
            throws Exception {
        List<File> result = new ArrayList<File>();
        File[] logfiles = aStartingDir.listFiles(new FileFilter() {

            @Override
            public boolean accept(File pathname) {
                return pathname.isFile();
            }
        });
        List<File> logFilesList = Arrays.asList(logfiles);
        File[] allDirs = aStartingDir.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.isDirectory();
            }
        });
        for (File file : logFilesList) {
            if (file.getName().equals("log.xml")) {
                result.add(file);
            }
        }
        List<File> allDirsList = Arrays.asList(allDirs);
        Collections.sort(allDirsList, new Comparator<File>() {
            public int compare(File o1, File o2) {

                if (o1.lastModified() > o2.lastModified()) {
                    return +1;
                } else if (o1.lastModified() < o2.lastModified()) {
                    return -1;
                } else {
                    return 0;
                }
            }

        });
        for (File file : allDirsList) {
            if (!file.isFile()) {
                List<File> deeperList = getFileListingLogs(file);
                result.addAll(deeperList);
            }
        }
        return result;
    }
444589
private void _registerDirRecursive (@Nonnull final Path aStartDir) throws IOException
  {
    // register directory and sub-directories
    Files.walkFileTree (aStartDir, new SimpleFileVisitor <Path> ()
    {
      @Override
      public FileVisitResult preVisitDirectory (final Path dir, final BasicFileAttributes attrs) throws IOException
      {
        _registerDir (dir);
        return FileVisitResult.CONTINUE;
      }
    });
  }
364636
protected synchronized void doStart()
        throws Exception
    {
        if (isStarted())
            return;
        
        _contextLog = LogFactory.getLog("org.browsermob.proxy.jetty.jetty.context."+getHttpContext().getHttpContextName());
        
        if (_contextLog==null)
            _contextLog=log;
        
        if (_sessionManager!=null)
            _sessionManager.start();
        
        // Initialize classloader
        _loader=getHttpContext().getClassLoader();

        if (_autoInitializeServlets)
            initializeServlets();
    }
332843
@Override
    public void createDirectory(final Path dir, final FileAttribute<?>... attrs) throws IOException {
        final Archive<?> archive = this.getArchive(dir);
        final ArchivePath parent = ArchivePaths.create(dir.toString()).getParent();
        if (parent != null && !archive.contains(parent)) {
            // IOException? Despite being a stupid choice for this, it's what the NIO.2 API uses.
            throw new IOException("Cannot recursively create parent directories for: " + dir
                + "; instead invoke \"createDirectories\"");
        }
        archive.addAsDirectories(dir.toString());
        if (log.isLoggable(Level.FINEST)) {
            log.finest("Created directory " + dir.toString() + " on " + archive.toString());
        }
    }
194598
public static void main(String[] args) {
        DirectoryIterator iter = new DirectoryIterator(args);
        while(iter.hasNext())
            System.out.println(iter.next().getAbsolutePath());
    }
1030804
public static List<TraceEvent> getEvents(FileReader fr, File directory) throws Exception
   {
      return getEvents(getData(fr, directory));
   }
1301198
private void scanForUnknownDirectories() {
      File[] filesInRoot = rootDirectory.listFiles();
      if (filesInRoot != null) {
         for (File maybeDirectory : filesInRoot) {
            if (maybeDirectory.isDirectory()) {
               String name = maybeDirectory.getName();
               try {
                  getDirectory(name);
               }
               catch (PersistenceException e) {
                  log.couldNotWalkDirectory(name, e);
               }
            }
         }
      }
   }
1360093
public Set getAllDirectoriesBelow(File dir) {
        Set allDirectories = new HashSet();
        if (dir.isDirectory()) {
            primGetAllDirectoriesBelow(dir, allDirectories);
        }
        return allDirectories;
    }
236075
public void watchDirectoryTree(Path dir) {
    if (_watchedDirectories == null) {
      throw new IllegalStateException("DirectoryWatcher.close() was called. Please make a new instance.");
    }
    try {
      if (Files.exists(dir)) {
        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
          @Override
          public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
            watchDirectory(dir);
            return FileVisitResult.CONTINUE;
          }
        });
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
908794
protected File createLogDir() {
        File logDir = Optional.ofNullable(logDirPath)
                                    .map(Paths::get)
                                    .map(Path::toFile)
                                    .orElse(new File(System.getProperty("java.io.tmpdir")));

        if (!logDir.exists()) {
            if (!logDir.mkdirs()) {
                log.warn("Unable to create log directory: " + logDir.getAbsolutePath());
                logDir = new File(System.getProperty("java.io.tmpdir"));
                log.info("Using default log directory: " + logDir.getAbsolutePath());
            }
        }

        File logs = new File(logDir, "zookeeper" + System.currentTimeMillis()).getAbsoluteFile();

        if (autoDeleteLogs) {
            logs.deleteOnExit();
        }

        return logs;
    }
180779
public String[] getDirectoryContent(String scannerBaseDir, String[] includes, String[] excludes, boolean followSymlinks, boolean globCaseSensitive, boolean scanDirectories) {
        File file = new File(scannerBaseDir);
        String[] fileNames;
        if (file.exists() && file.isDirectory()) {
            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir(scannerBaseDir);
            scanner.setIncludes(includes);
            scanner.setExcludes(excludes);
            scanner.setFollowSymlinks(followSymlinks);
            scanner.setCaseSensitive(globCaseSensitive);
            scanner.scan();
            if (!scanDirectories) {
                fileNames = scanner.getIncludedFiles();
            } else {
                fileNames = scanner.getIncludedDirectories();
            }
            return fileNames;
        } else {
            logger.debug("{} is not a folder", scannerBaseDir);
            return new String[0];
        }
    }
1107171
public RunT loadBuild(File dir) throws IOException {
        try {
            return getBuildClass().getConstructor(asJob().getClass(), File.class).newInstance(asJob(), dir);
        } catch (InstantiationException | NoSuchMethodException | IllegalAccessException e) {
            throw new Error(e);
        } catch (InvocationTargetException e) {
            throw handleInvocationTargetException(e);
        }
    }
167085
public static List<File> findFiles(final String start, final String[] extensions)
	{
		final List<File> files = new ArrayList<>();
		final Stack<File> dirs = new Stack<>();
		final File startdir = new File(start);
		if (startdir.isDirectory())
		{
			dirs.push(new File(start));
		}
		while (dirs.size() > 0)
		{
			final File dirFiles = dirs.pop();
			final String s[] = dirFiles.list();
			if (s != null)
			{
				for (final String element : s)
				{
					final File file = new File(
						dirFiles.getAbsolutePath() + File.separator + element);
					if (file.isDirectory())
					{
						dirs.push(file);
					}
					else if (match(element, extensions))
					{
						files.add(file);
					}
				}
			}
		}
		return files;
	}
479491
private void processDirectory(File directory) throws IOException, ClassNotFoundException {

        findFiles(directory);
        File[] files = directory.listFiles();
        if (files != null) {
            for (File file : files) {
                if (file.isDirectory()) {
                    processDirectory(file);
                }
            }
        }
    }
1329030
public static List<File> listDirs(final File dir)
	{
		final List<File> foundedDirs = new ArrayList<>();
		final File[] fileArray = dir.listFiles();
		for (final File element : fileArray)
		{
			if (element.isDirectory())
			{
				foundedDirs.add(element);
			}
		}
		return foundedDirs;

	}
648847
public static File[] getLogFiles(File[] logDirList,long snapshotZxid) {
        List<File> files = Util.sortDataDir(logDirList, "log", true);
        long logZxid = 0;
        // Find the log file that starts before or at the same time as the
        // zxid of the snapshot
        for (File f : files) {
            long fzxid = Util.getZxidFromName(f.getName(), "log");
            if (fzxid > snapshotZxid) {
                continue;
            }
            // the files
            // are sorted with zxid's
            if (fzxid > logZxid) {
                logZxid = fzxid;
            }
        }
        List<File> v=new ArrayList<File>(5);
        for (File f : files) {
            long fzxid = Util.getZxidFromName(f.getName(), "log");
            if (fzxid < logZxid) {
                continue;
            }
            v.add(f);
        }
        return v.toArray(new File[0]);

    }
727360
public static List<File> getAllFilesFromDir(final File dir)
	{
		final List<File> foundedFileList = new ArrayList<>();
		final File[] children = dir.getAbsoluteFile().listFiles();
		if (children == null || children.length < 1)
		{
			return foundedFileList;
		}
		for (final File child : children)
		{
			// if the entry is not a directory
			if (!child.isDirectory())
			{
				// then
				// entry is a file
				foundedFileList.add(child.getAbsoluteFile());
			}
		}
		return foundedFileList;
	}