I have a simple script that scans FTP directories every 15 minutes for new files. When a file is found the script:
1. puts the file name in an array
2. moves/renames the file to another server
3. queries a DB to see who the file belonged to
4. sends an email listing the owner/file pairs
My problem comes when I receive large files. Several times a month I receive files in excess of 500MB. What happens is the notice email is sent that the file has arrived, but the file has not fully arrived yet. So, I may get 8 notices (if it takes 2 hours to receive the file) before the file is fully received.
How do I validate that the entire file is present before adding its name to the array (Step 1 above)??
1. puts the file name in an array
2. moves/renames the file to another server
3. queries a DB to see who the file belonged to
4. sends an email listing the owner/file pairs
My problem comes when I receive large files. Several times a month I receive files in excess of 500MB. What happens is the notice email is sent that the file has arrived, but the file has not fully arrived yet. So, I may get 8 notices (if it takes 2 hours to receive the file) before the file is fully received.
How do I validate that the entire file is present before adding its name to the array (Step 1 above)??