commons-io

Recursively finding only directories with FileUtils.listFiles

I want to collect a list of all files under a directory, in particular including subdirectories. I like not doing things myself, so I'm using FileUtils.listFiles from Apache Commons IO. So I have something like: import java.io.File; import java.util.Collection; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefi...

Read a specific line from a text file

Hello, Is there any method to read a specific line from a text file ? In the API or Apache Commons. Something like : String readLine(File file, int lineNumber) I agree it's trivial to implement, but it's not very efficient specially if the file is very big. Thanks in advance ...

Apache FileUtils listFiles

Hey everyone I'm trying to get a List of directories. I'm using FileUtils listFiles(). I want to do something like this: listFiles(File,IOFileFilter,false). My real questions is how I can implement the accept() from the IOFileFilter so I can check if current File is a directory? Thank you in advance. ...

Trying to copy file from one location to another

Hello I'm trying to copy file to another directory with commons fileUtils. I tried this FileUtils.copyFile(getOutputFile(), new File("RESULT/final_result.txt"); The new final_result.txt file contains only the first line of my output file, what did I do wrong? Is there an alternative to commons IO, or some other way I'll take any as ...