All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.baltoro.client.LocalFileHelper Maven / Gradle / Ivy

There is a newer version: 4.0.12
Show newest version
package io.baltoro.client;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.util.ArrayList;
import java.util.List;

public class LocalFileHelper
{

	static List getDirectories(String rootPath)
	{
	
		 Path root = Paths.get(rootPath);
		 final List paths=new ArrayList<>(2000);
		 try 
		 {
			 	
			 Files.walkFileTree(root, new SimpleFileVisitor()
			    {
					
					@Override
					public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
					{
						paths.add(dir.toString());
						return FileVisitResult.CONTINUE;
					}
				 
			    
			    });
		 } 
		 catch (IOException e) 
		 {
		      e.printStackTrace();
		 }
		 
		 return paths;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy