1. Write a shell script , connect to remote server using sftp.
2. Check the sum of file(*.ZIP) size as remote server file size
3. On Host server , check the free space
4. If free space less than remote server file size then stop the script execution and send email alert.
5. If free space greater than remote server file size then check are there any corrupted files on remote server.
6. If corrupted files exists then stop the job and send email alert.
7. If no corrupted file then download the files to host server.
8. If downloading files fail for any reason, try re-downloading X number of times.
9. Once after download, check remote server file size and downloaded files size
10. If not equal send email alert.