Firstly, how do you determine which is the last file?
Is it a sequential transfer(one
thread read a file after another) or a concurrent one(multiple threads read different files)?
To answer your question. Exists method will return true if the file is present on the file system. Whether it is written completely or not is something that only the application writing to the file can tell.
There are ways in which the application can indicate whether the job is finished, few of them are:
1) When the writing process is underway, write to a temp file. When the writing is complete rename the file to original file name.
2) Have a file(kind of a lock file) that indicates that the process is writing to the system. When writing finishes, remove the lock file.
In the above cases, the presence of the required file or the absence of the lock file will tell that the writing is finished.
Did I answer your question?