Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle incomplete files? Getting exception

I need to create a java program which will create thread to search for a file in particular folder(source folder) and pick the file immediately for process work(convert it into csv file format) once it found the file in the source folder. Problem i am facing now is file which comes to source folder is big size(FTP tool is used to copy file from server to source folder), thread is picking that file immediately before it copies fully to source folder and throwing exception. How do i stop thread until the file copy into source folder completely?. It has to pick the file for processing only after the file is copied completely into source folder.

like image 250
raja Avatar asked Feb 04 '09 06:02

raja


1 Answers

Tha safest way is to download the file to a different location and then move it to the target folder.

Another variation mentioned by Bombe is to change the file name to some other extension after downloading and look only for files with that extension.

like image 166
qbeuek Avatar answered Sep 23 '22 15:09

qbeuek