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 test;
- import java.io.File;
- /**
- *
- * @author Thieu Mao
- */
- public class ScanFileDemo {
- public static void main(String[] args) {
- String myDirectoryPath = "D:\\Test";
- File dir = new File(myDirectoryPath);
- int i = 0;
- for (File child : dir.listFiles()) {
- // Do something with child
- System.out.println(i++ + child.getName());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment