vitalii_hrushyn
8/4/2016 - 11:09 AM

show folders

show folders

package com.gmail.vhrushyn;

import java.io.File;
import java.util.Scanner;

public class main {

	public static void main(String[] args) {
		
		System.out.println("input folder addres (with correct sleshs) or just '.' to show current directory");
		Scanner sc = new Scanner(System.in);
		String folderAddres = sc.nextLine();
		File folder = new File(folderAddres);		
		showFolders(folder);
		sc.close();
	}
	static void showFolders(File folder) {
		File [] fileArray = folder.listFiles();
		for (File folder2 : fileArray) {
			if (folder2.isDirectory()) {
			System.out.println(folder2);
			showFolders(folder2);
			}
		}		
	}
}