Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package scandemo;
- import java.io.File;
- /**
- *
- * @author Thieu Mao
- */
- public class Scan {
- public static void main(String[] args) {
- ScanFolder("D:\\");
- }
- private static void ScanFolder(String myDirectoryPath) {
- File dir = new File(myDirectoryPath);
- for (File child : dir.listFiles()) {
- String str = child.getName();
- if (child.isDirectory()) {
- ScanFolder(myDirectoryPath + "\\" + str);
- } else {
- System.out.println(str);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment