Keep control of file transfer

Advertisement

natha
Joined:
Posts:
2

Keep control of file transfer

Hi,
I am using WinSCP in MS SQL Server DTS package to download files from remote to local server on daily basis.

I am doing it this way in the script file:

[...]
# Download file(s) to the local directory d:\
get *.txt c:\BaseCDR\
# Delete downloaded file(s)
rm *.txt
[...]

Is there a way to control that the files have been properly downloaded before removing them from remote server?

Consider following:
1. I cannot use remote recycle bin.
2. It has no sense to count the downloaded files on local side, since the amount of files may vary.
3. Is there any way to retrieve number of files on remote server (compare local with remote)?

Thanx in advance for your reply.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Re: Keep control of file transfer

Use "option batch abort" to abort the script in case "get" fails.
_________________
Martin Prikryl

Reply with quote

Ren
Guest

option batch abort not behaving as expected

I'm using WinSCP 3.8.2 standalone, and have the following script:

<script>
# abort on error
option batch abort
# switch to download directory
cd /download
# set transfer mode to ascii
option transfer ascii
# download the report files
get *.dat
# clear the download directory
rm *.dat
# disconnect
close
# exit WinSCP
exit
</script>

When a file exists in the target dir, the get command will issue an overwrite command and fail. However, the script continues with the next step, which clears the download directory. Given the 'option batch abort', I would not expect this, and do not want this. Your previous reply also indicates this should work.

How can I make the script really bail out when the get command fails?

Thanks.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Re: option batch abort not behaving as expected

Abort of file transfer in case the remote file exists and overwrite is not allowed is not considered a failure. I can understand you do not like that. But it is designed so.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum