Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Matthias wrote:

What will happen after we losed the internet connection (mobile connection) with a file which was not completly transfered? Will WinSCP overwrite/replace the not complete one on the FTP server automatically without using "-resume" or "-neweronly" ?

WinSCP by default reconnects and resumes the transfer. While resuming the transfer, it might need to do the listing to check for the partially transferred file.
Matthias

Hi Martin,
thank you very much for you detailed answer.
We are using a mobile connection and it could happen that the upload will be interrupted by a connection break (mobile net error etc).
In this case we want to sure that this damaged file on the FTP server will be replaced or resumed.

What I understood is that we will only delete the original file on the computer after the transfer was successful. What will happen after we losed the internet connection (mobile connection) with a file which was not completly transfered? Will WinSCP overwrite/replace the not complete one on the FTP server automatically without using "-resume" or "-neweronly" ?

If that works and we will not create this listing traffic, then it could be the solution for our issue.

Thank you very much
martin

1) Your new batch file uploads all files from the local source folder. If you want to upload all files, you do not need to use the -neweronly switch and WinSCP won't have to do the listing.

2) With your new script, the listing is caused by the -resume switch. You should not use -resume switch, unless you explicitly want to resume a previously broken transfer.
Matthias

Hi Martin,
thank you very much for your answer.
It sound that there is no special funktion avaiable to deactivate the "Directory listing".
Due to the mobile data connection it could happen that we lose the internet connection during a upload process. For that I think it should be a must to use this comment "-neweronly" to overwrite existing data on the FTP server which were not fully transmitted/uploaded.

Do you have any idea how we could be sure that a file was uploaded successfull (to 100%) without creating too much traffic (caused maybe by this Directory listing) ?

By the way: We tested another script time based, but have the same issues here.
".bat"
@echo off
:start
cls
echo FTP-Upload Process
for /F %%i in ('dir /b "D:\-FTP-DATEN-\*.*"') do (
   echo Found new data for upload:
   echo %%i
   "C:\Program Files (x86)\WinSCP\winscp.com" /script=ftp.txt /parameter %%i
)
timeout 60
goto start

This .bat-script will start a upload process for every file which is included in the mentioned folder and start again after 60 seconds.

ftp.txt
option reconnecttime 30
option confirm off
option batch on
option failonnomatch on
open ftp://user:pw@server
rm "%1%"
put D:\-FTP-Data-\"%1%" / -delete -resume
echo Upload process successful
exit


I was playing with some parameters such as confirmation, batch and failonnomatch without seeing anything being better for our use case.
I think the "rm" function will also ask for the content of the FTP server and will create this traffic (Directory listing). I am right ???

Thank you
martin

With -neweronly, WinSCP needs to know what files are on the server already.
Matthias

Hi,
thanks for your support.
We are using WinSCP for Upload via 4G mobile connection.

We use a very simple configuration-file and open it with a ".bat" script every 5 minutes.
Here the most important part out of the ".bat"-file:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /ini=nul /script="D:\USER\FTP-Upload\config.txt


open ftp://user:pw@ip
put -resume -neweronly D:\FTP-Data\*.* /
exit

We never had issues with WinSCP, but in the current case it seems that we have a very special FTP server. The FTP owner told us, that we have to turn off "Directory Listening" to reduce the data transfer via 4G mobile net.

I could currently not provide a log file. But I will try to do it soon.
Do you have any hints or solutions for us?
Thank you very much.

Matthias
martin

Re: CMD Script for FTP Upload - Directory Listening issue

How are you using WinSCP? For download or upload? Show us your script. Post a log file.
Matthias

CMD Script for FTP Upload - Directory Listening issue

Hello,
we are using a script in combination with WinSCP. It is running fine. WinSCP is a very good tool, great work!
But we have an issue with too much datatransfer. WinSCP is asking the FTP for "Directory Listening" and we would like to deactivate this functionality.
More and more data will be uploaded to the FTP server and the datatransfer is increasing.

Is there any possiblity to avoid this Directory Listening and asking the FTP after every connection for the complete contant of the folder/share?

Thank you very much in advance.
Matthias