Sunday, 20 Sep 2020

How to Automate FTP Upload from the Windows Command Line

Using batch files on your Windows makes the work on our Computer much easier and personally I find myself creating the batch files quite often because it makes my work much easier and one of the most common use of this batch files is uploading files the remote FTP servers and also this batch files helps you to automate common tasks.

So here we will walk through the tutorial on how to automate FTP upload from the Windows Command line. So here is what you will need to do to make this thing work.

But if you are new to this FTP Upload then here are some of the basic things you will need to know about this FTP.

What is FTP?

FTP generally stands for File Transfer Protocol is a standard network protocol used to transfer the computer files from one host to another host over a TCP-based network such as the Internet.

And the most common way to upload through the File Transfer Protocol is using the Windows Command Line.

So here are things you need to follow to automate FTP upload from the Windows Command Line.

Weebly will be helping you to upload and create your websites without FTP. And all that, with simple drag and drop options. And you will be able to create whatever you want, with really simple functions. There are many options for free accounts, and paid options as well. If you want to buy yourself a paid one, get and use this weebly coupon and save your money right off the bat.

Automate FTP Upload from the Windows Command Line:

First of all you will need to create a file called fileup.bat in your Windows directory or any of your directories on your path and you can use the “path” command to know your current path.

To create the bat file you will need to copy the below text in your Notepad and save it as fileup.bat.

Copy The Following:

@echo off

echo user MyUserName> ftpcmd.dat

echo MyPassword>> ftpcmd.dat

echo bin>> ftpcmd.dat

echo put %1>> ftpcmd.dat

echo quit>> ftpcmd.dat

ftp -n -s:ftpcmd.dat SERVERNAME.COM

del ftpcmd.dat

Note: You will have to replace the above “MyUserName”/ MyPassword/ SERVERNAME.COMwith your correct the values of your FTP servers.

This batch file will script the FTP utility using the command line utility. As this batch file uses the echo command to send the message to the FTP server.

You can change the directory command by using this echo command:

echo cd /pathname/>>ftpcmd.dat

Now you will have to call the batch file to do it you will use the fileup.bat given at the beginning part of the article but you will actually not need to type your .bat part of the filename to make it work.

Example of it is:

> fileup

Connected to
220 Microsoft FTP Service
ftp> myusername
331 Password required for myusername.

230 User myusername logged in.
ftp> bin
200 Type set to I.
ftp> put
200 PORT command successful.
150 Opening BINARY mode data connection for
226 Transfer complete.
ftp: 106 bytes sent in 0.01Seconds 7.07Kbytes/sec.
ftp> quit

Well that is all you will need to do to automate FTP upload your files from one Server to another so now you know how to automate FTP upload from the Windows Command line