Topic "Keep control of file transfer"

Author Message
natha
[View user's profile]

Joined: 2006-10-19
Posts: 2
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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Use "option batch abort" to abort the script in case "get" fails.
_________________
Martin Prikryl
Ren

Guest


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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License