Previous thread (which includes sample script and some replies) is:
https://www.unix.com/shell-programmin...scp-files.html
Can you tell us what Operating Systems and versions are involved?
Do you have administration rights over the target computer(s)?
Are you trying to make a choice between "ftp" and "scp" or are you trying to get both working reliably?
For automated "ftp" we usually transfer the files under a temporary file name and then rename the whole batch at the end of the file transfer (but still in the same ftp job). I have never seen a partial "ftp" where a subsequent command in that same ftp job is still executed. Tested this technique to destruction including rebooting computers, pulling the lan cable, killing processes etc. .
If your "ftp" program does not have a timeout, you need to implement a timeout process.
For dodgy networks or critical data we also create and transfer a control checksum file after the main files, then get the remote system to create a matching control checksum file, then transfer the new control checksum file back for comparison. Have used this technique for migrating large numbers of user accounts to a barely-compatible unix platform.