A user wants to copy big files some gigabytes in java and I want to monitor the process to provide some kind of information, when the process is done.
I am monitoring the file system to check when a new file is created, modified or deleted. However, when a big file is transferred, I get a lot of "ENTRY_MODIFY" events - I would like to see the "ENTRY_CREATE" event (Which is done) and then I need some kind of mechanism that waits until the copy process is done.
Up to now I have a solution like this in my code for "ENTRY_CREATE":
long oldSize = f.length();
long newSize = -1;
while(oldSize!=newSize)
{
oldSize= newSize;
}
newSize = f.length();
Any suggestions for this?
Thank you