I'm trying to create a batch file that uploads files to an FTP server. It all works fine except for one specific folder which has mutations/vowels in its name (can't change that. Aka the folders name has an ö inside. ).
My question here is: What options exist to achieve this?
Example for the ftp batch file (UTF-8 encoding):
cd C:\uplaodfiles\ländle\*
ftp -n -s:C:\test\UploadTest.ftp
Example for the loaded file:
open meimei
user meiuser meipassword
pasv
bin
cd uploaddir
prompt
mput c:\uploadfiles\ländle\*
close
bye
It all works until the mput where the ftp tries to convert the ä into special characters that the local drive naturally does not find.
As additional note: I start out in the c:\test folder on the command line as the UploadTest.bat file is located there.....even though I use cd. thus if I use mput without parameters (or with only * given) it is still c:\test which he copies.
Edit:
The output from a run (I cut out the non important parts..... pasv fails btw. No clue why? Had showed it previously so I'm leaving that part out).
ftp> BIN
200 Command okay.
ftp> cd uploaddir
250 CWD command successful.
ftp> prompt
Interaktivmodus AUS . <-- interactive mode off
ftp> mput C:\L├ñndle\* <-- should be Ländle
C:\Ländle\*:Datei nicht gefunden <-- file not found
ftp> close
221 Service closing control connection.
ftp> bye
As a bit of it is in German I've put in translations where necessary with <--
It works, as long as the UploadTest.ftp is either
The UTF-8 in batch files does not seem to be supported (both in Windows 7 and Windows 10). So you cannot do the cd there (unless in the default legacy ANSI encoding).
If you need a UTF-8 solution for Windows 7, you probably have to use another FTP client.
For example with WinSCP scripting:
Batch file:
winscp.com /log=UploadTest.log /script=UploadTest.ftp
Upload script (UploadTest.ftp) in UTF-8 encoding with BOM:
open ftp://meiuser:meipassword@meimei/
cd uploaddir
put c:\uploadfiles\ländle\*
exit
See the guide for Converting Windows FTP script to WinSCP script.
(I'm the author of WinSCP)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With