How to get contents of a folder and put into an ArrayList

The easiest way of doing that is:

File f = new File("C:\\");
ArrayList<File> files = new ArrayList<File>(Arrays.asList(f.listFiles()));

And if what you want is a list of names:

File f = new File("C:\\");
ArrayList<String> names = new ArrayList<String>(Arrays.asList(f.list()));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)