1

I am trying to transfer multiple files through FTP from a local directory - C:\Users\Documents\FTP\*.* to the Domain.

I've approached like the below.

First I've created a batch script DISCH.BAT as below ::

open ftp://[email protected]/outbound/Pre/Release/ 
USERNAME 
PASSWORD 
binary
mput C:\Users\Documents\FTP\*.*
quit

I've created another batch file RUN.BAT as below :

ftp -i -s:C:\Users\Desktop\DISCH.bat

When I am running the RUN.BAT ie., the second one, nothing is happening. Can you please advice where I am going wrong.

Thanks in advance.

4
  • How do you run it? Did you run it from console window (cmd.exe) so that you can spot any errors? Commented Jun 21, 2017 at 9:04
  • Though if you are trying to run a command-line ftp client from your C# application, instead of native C# code, it's a really bad solution: stackoverflow.com/q/44669001/850848 - And you did respond neither to my comment nor the answer yet! Commented Jun 21, 2017 at 9:07
  • I am running it directly... Double clicking RUN.BAT Commented Jun 21, 2017 at 9:13
  • So no wonder you cannot see what went wrong. Test it in the console. Or add pause at the end of the batch file. But anyway, you first have to fix the problem I have shown in my answer. Commented Jun 21, 2017 at 9:19

1 Answer 1

1

The argument to open is not URL, but only a hostname:

open XXX.XXXXXX.net

To enter the desired folder, use cd command after the credentials:

cd /outbound/Pre/Release/ 
Sign up to request clarification or add additional context in comments.

2 Comments

Hi Martin. Thank you for your answer. The FTP Path can be accessed with [email protected] but not with simple XXXX.net. Can there be a way I can use in this format..??
You specify the username in the USERNAME line in the script. Again, the open command takes only hostname, nothing else. All the other information has to be provided using other means. Command-line ftp.exe does not use the concept URL, which you may know from Windows explorer or other FTP clients.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.