What do you mean "takes a while"? If you're watching the directroy via Windows Explorer then you will need to wait for the refresh time of Explorer - it is not real time.
Need Java help? Want to help people who do? Sit down with a cup of Java at the [url=http://forums.hotjoe.com/forums/list.page]hotjoe[/url] forums.
Sure they're new - come get them started!
In a loop i use the File.fileList() method to detect if there are files in a directory. The loop is running continuosly, when i go trouhg and read the files listed in the array generated by the fileList method i deleted the files once they've been processed. When there are few files (lets say 1 or 2) in the directory, sometimes, even though the delete() method returns true, the fileList method returns the same one or two files again. These can happens maybe 3-4 times, i mean, the fileList in the loop "sees" the files for a while.
That's what i mean with "it takes a while"
It really sounds like there is a bit of caching going on. I Googled on [url=http://www.google.com/search?hl=en&lr=&c2coff=1&q=file+system+caching+windows]some terms[/url] and learned alot. Basically it looks like Windows maintains a cache of disk blocks in memory. I'm honestly not sure that that is the issue you're seeing but it would make sense.
The proof would be to write a native code method that calls the Windows API to do about the same thing you're doing - a non-trival task without the right tools.