-
-
Save mariiaKolokolova/f984fbf4660e894f4d43c2b29744528e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
System.out.println("Input folder:"); | |
Scanner sc = new Scanner(System.in); | |
String folderName = sc.nextLine(); | |
folderList(folderName); | |
sc.close(); | |
} | |
static void folderList(String folderName) { | |
File folder = new File(folderName); | |
for (File file : folder.listFiles()) { | |
if (file.isDirectory()) { | |
System.out.println(file.getName()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment