thieumao

Scan File Demo (Scan in 1 Folder)

Sep 23rd, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package test;
  6.  
  7. import java.io.File;
  8.  
  9. /**
  10.  *
  11.  * @author Thieu Mao
  12.  */
  13. public class ScanFileDemo {
  14.  
  15.     public static void main(String[] args) {
  16.         String myDirectoryPath = "D:\\Test";
  17.         File dir = new File(myDirectoryPath);
  18.         int i = 0;
  19.         for (File child : dir.listFiles()) {
  20.             // Do something with child
  21.             System.out.println(i++ + child.getName());
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment