0

How to check if a File exists within a Directory in Java

Background

This article demonstrates how to check if a file exists in a directory in Java.

Software Environment

  • Windows 7 Professional SP1
  • Eclipse – Kepler Release
  • Java 1.7 (1.7.0_67 – Windows x86)
  • Apache Commons IO 2.4

First Things, First!

Download Apache Common IO from http://commons.apache.org/proper/commons-io/. The library has no dependencies. If you are using an IDE, reference the .jar file.

Use It

Get the Codes

https://github.com/Turreta/File-I-O-in-Java/blob/master/src/com/turreta/apache/commons/io/file/CheckFileInDirectory.java