Here you can find the source of writeFilenames(String folderPath, LinkedList
public static void writeFilenames(String folderPath, LinkedList<File> listOfPopulationFiles) throws IOException
//package com.java2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.LinkedList; public class Main { public static void writeFilenames(String folderPath, LinkedList<File> listOfPopulationFiles) throws IOException { FileWriter filesFile = new FileWriter(folderPath + System.getProperty("file.separator") + "files.csv"); BufferedWriter outFiles = new BufferedWriter(filesFile); outFiles.write("Filenames"); outFiles.newLine();//from www.ja v a 2 s .c om for (int i = 0; i < listOfPopulationFiles.size(); i++) { outFiles.write(listOfPopulationFiles.get(i).getName().substring(0, listOfPopulationFiles.get(i).getName().length() - 4)); outFiles.newLine(); } outFiles.close(); } }