thieumao

Scan File Demo 2

Sep 25th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package scandemo;
  6.  
  7. import java.awt.List;
  8. import java.io.File;
  9. import java.util.ArrayList;
  10.  
  11. /**
  12.  *
  13.  * @author Thieu Mao
  14.  */
  15. public class test {
  16.  
  17.     public static void main(String[] args) {
  18.         File directory = new File("D:\\Test");
  19.  
  20.         String[] directoryContents = directory.list();
  21.  
  22.         ArrayList<String> fileLocations = new ArrayList<String>();
  23.  
  24.         for (String fileName : directoryContents) {
  25.             File temp = new File(String.valueOf(directory), fileName);
  26.             System.out.println(String.valueOf(temp));
  27.             fileLocations.add(String.valueOf(temp));
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment