Java - Unable to Detect Files
<p>Following on from my previous <a href="http://stackoverflow.com/questions/9369892/java-perform-function-on-newly-generated-files-within-directory">question</a>, my program doesn't detect the 300 images that have just been created in a particular directory; instead, it only detects <code>desktop.ini</code>, which is not the case as I can physically see that the files have been created within said directory and do exist.</p>

<p>Can somebody please explain why this happens as when I run the program the next time, it seems to work just fine?</p>

<p>The only way that something is detected within the directory on the first run is when there is at least one file which exists in the directory before the program is compiled and executed.</p>

<p>Many thanks.</p>

<p><strong>UPDATE:</strong> Files are detected as follows:</p>

<pre><code>//Default greyscale image directory (to convert from greyscale to binary).
static File dirGrey = new File("test_images\\Greyscale");
//Array of greyscale image filenames. 
static File imgListGrey[] = dirGrey.listFiles();
</code></pre>
