Search code examples
javaio

Check if large file was uploaded fully into dir before processing


I have a cron job that picks up a file from my hot folder and does some crazy stuff. The problem is that it picks up partially uploaded files and starts processing them. Is there a way to check if file was uploaded fully into directory, before processing it.


Solution

  • One of the workarounds I figured before is or to rename the file being uploaded to something "original_file.completed" or to create empty "original_file.completed" file after processing finishes and check the existence of that file before work with the original.