Get & Put save only if the transfer is completed.

Advertisement

Dimitris
Guest

Get & Put save only if the transfer is completed.

Hello, i need your help!!! :D :D

That's my senario:

I have an FTP server(in IIS @server21012R2 ) in branchA
I have winscp client in Branch B
I run the following script at Branch B every hour:
-----------------------------------------------------------
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect to FTP server using a password
open ftp://username:password@192.168.1.1:21
# download file delete after completion exclude subfolders
cd /Outbox/
Option exclude */
get -delete *.* F:\Sync\Inbox\*.*
# Disconnect
close
exit
----------------------------------------------------------------



With this senario if i lost the connection while the files transfering. I receive one file for example "test.txt" which is not completed.
Because it is not completed it will not be deleted from the server and when it comes the time to repeat the script it i will be received completely.

The problem is that i don't want to save the file if it is not completed download because i use that files for another operation and until running again the script i have already used these files and i received errors to the application.

Is there any way to solve it? Thanks in advance. If you want any details i can upload



Additionally i do the same for the uploading:
-----------------------------------------------------------------
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect to FTP server using a password
open ftp://username:password@192.168.1.1:21
# Upload file After complete delete files from source
cd /Inbox
Option exclude */
put -delete F:\Sync\Outbox\*.*
# Disconnect
close
exit
-----------------------------------------------------------------

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: Get & Put save only if the transfer is completed.

There's no easy solution with FTP protocol.
With SFTP, WinSCP appends a .filepart extension to incomplete files. But not with FTP.

Reply with quote

Advertisement

You can post new topics in this forum