the Internet Windows Android

FTP clients from the command line. Standard Windows FTP Client Utility from the command line (CMD) - to back up or download files without your participation (automatically)

The standard Windows FTP client utility from the command line (CMD) is to back up or download files without your participation (automatically).

  1. open - Connect to a remote host on FTP;
  2. cD - switch to another directory on the server;
  3. bin - binary data transfer mode between the server and the client;
  4. pUT - file transfer to FTP;
  5. bYE - Complete session with server and output.

In order to master the Windows FTP client and start working with it, let's try to connect to any FTP server in the console mode, for example, 213.43.125.75.

Enter Open 213.43.125.75 (this is the IP address of the FTP server), instead you enter the address or domain of the FTP server you need, you will need to enter the username and password. After successful authorization, we create a folder to place archives on the FTP, without a long time thinking, we call it backup (the folder is created by the mkdir command). Now go to the CATalog you created by the following command: CD Back-up. In the next step, copy the file to the server, for which you want to set the file transfer mode to the "binary" bin command without any parameters. And now we enter PUT D: /Back-up/Back-up.zip, where the PUT command parameter will be the full path to the copied file. When copying, you can specify the mask in the directory for example: D: / back-up / *. Zip (* .zip - all files with the "ZIP" extension). After copying, you close the connection with the server by the BYE command.

In order for our FTP client to do everything automatically, without asking questions, create a script for him. The following is a text file (call it back-up.ftp and save the C: / disk root for ease of use and writing to the start line) containing a number of commands for FTP clients that will automatically be executed when the FTP client is started from Command line.

Open 213.43.125.75 (instead of numbers - the address of the desired FTP server)
user
password
cD Back-up (go to the existing directory on the FTP server)
bin (transmission mode - binary)
PUT D: /Back-up/Back-up.zip (path to the file on your computer)
BYE (Completion Completion)

As a result, the File back-up.ftp must be the following:

open 213.43.125.75
user
password
cD Back-up
bin.
PUT D: /Back-up/Back-up.zip

The data control commands are exchanged by the Server Interpreter and the User Interpreter Interpreter, can be divided into three large groups:

Teams of access to the system.

Data flow control commands.

FTP service commands.

Consider several of the most characteristic teams from each group. Among the access control commands, the following should be noted:

User.. As a rule, this command opens the FTP session between the client and the server. The command argument is the name (identifier) \u200b\u200bof the user to work with the file system. This command can be submitted not only at the beginning, but in the middle of the session, if, for example, the user wants to change the identifier, on behalf of which will be actions. At the same time, all variables belonging to the old identifier are exempt. If data exchange occurs during the identifier change, the exchange is completed with the old user identifier.

PASS. This command is submitted after entering the user ID and, as an argument contains a user password. Recall that the FTP authentication data is transmitted over the network in open text, so to ensure channel security to ensure additional measures.

CWD. The command allows users to work with different directories of the remote file system. The argument of the command is a string indicating the path of the remote file system directory in which the user wishes.

Rein. Reinitialization team. This command clears all the current user variables, resets the connection parameters. If the data transmission takes place at the time of the command, the transmission continues and ends with the previous parameters.

Quit. The command closes the control channel. If the data transmission takes place at the time of the command, the channel closes after the end of data transmission.

Teams flow controlset data transfer settings. All parameters described by these commands have the default value, so the flow control commands are used only when it is necessary to change the default transmission parameters value. The flow control commands can be supplied in any order, but they must all precede the FTP service commands. From the data flow control commands, select the following:

Port.. The command assigns the address and port of the host, which will be used as an active member of the connection channel. The command arguments are a 32-bit IP address and a 16-bit connections port number. These values \u200b\u200bare divided into six 8-bit fields and are presented in decimal form: H1, H2, H3, H4, P1, P2, where HN - bytes of the address (from the older to younger), and PN is the port bytes (from the older to the younger) .



PASV. This command is sent to the module that will play a passive role in data transmission ("listen" connection). The answer to this command should be a string containing the address and port of the host, which are in the mode of standby mode in the format of the PORT - "H1, H2, H3, H4, P1, P2" command.

Teams Type, Stru, Mode Determine, respectively, the type of data transmitted (ASCII, image, and others), the structure or data format (File, Record, Page), the transmission method (Stream, Block and others). The use of these commands is very important when constructing interaction in heterogeneous environments and very different operating and file systems of interacting hosts.

Teams FTP service Define actions that need to be made with specified files. As a rule, the argument of the commands of this group is the path to the file. The syntax of the specified path must satisfy the requirements of the file processor file system. From the FTP service commands, you can select the following:

Retr. This command indicates the "Server Data Program" module to send a copy of the file specified by the parameter of this command, the data transfer module at the other end of the connection.

Stor. The command indicates the "Server Data Transmission Program" module to take data on the data transfer channel and save them as a file whose name is set by the parameter of this command. If such a file already exists, it will be replaced by a new one, if not, a new one will be created.

Teams Rnfr. and RNTO Must follow one after another. The first command contains an old file name as an argument, the second is new. Sequential use of these commands renames the file.

Abor. The command instructs the server to interrupt the execution of the previous service command (for example, a file transfer) and close the data channel.

Team DELE Removes the specified file.

Teams MKD. and RMD., respectively, create and delete the directory specified in the argument.

Using commands List and NLST. You can get a list of files in the specified directory.

All FTP protocol commands are sent by the "user protocol interpreter" in text form - on the same command in the string. Each row of command - identifier and arguments - end with symbols . The command name is separated from the argument with a space symbol - .

Command handler Returns the processing code for each command consisting of three digits. Processing codes are a specific hierarchical structure and, as a rule, a specific command can be returned only a specific set of codes. The command processing code follows a space symbol - , Then follows the explanation text. For example, a string of successful completion of the operation looks like this: "200 Command Okay.

Below is an example of working with the FTP protocol. Designations: S - Server, U - User.

S: 220 SERVICE READY FOR NEW USER

\u003e S: 331 USER NAME OKAY, NEED PASSWORD

S: 230 User Logged in, Proceed

U: Retr Test.txt

S: 150 File Status Okay; About to Open Data Connection

<Идет передача файла...>

S: 226 Closing Data Connection, File Transfer Successful

S: 200 COMMAND OKAY

U: Stor /Home/images/First.my

S: 550 Access Denied

Commands and responses are transmitted by the control connection between the client and the server in the NVT ASCII format. At the end of each row of the command or response there is a CR, LF pair.

The only Telnet commands (starting with iac), which can be sent to the server to the server - is a process interrupt command ( ) and telnet synchronization signal ( In urgency mode). We will see that these two Telnet commands are used to terminate the file transfer or in order to send a request to the server during the transmission process. If the server receives a command from the client with a Telnet option (Will, Will, Do or Dont), it responds either dont or Wont.

Commands consist of 3 or 4 bytes, namely from the capital ASCII characters, some with optional arguments. The client can send to the server more than 30 different FTP commands. Table 5.1 shows some of the most widely used commands, most of which we will look at in this chapter.

Table 5.1.

Common FTP teams.

In the examples, we will see that some commands completely coincide with what enters the interactive user as FTP commands. In this case, they are transmitted by the control connection, however, some commands entered by the user generate several FTP commands, which, in turn, are transmitted to the control compound.

Hello everyone today will tell about the ftp.exe utility as a tool for working with FTP servers.

To work with FTP servers, it is not necessary to use cumbersome (and sometimes not free) FTP clients at all, for the simplest operations, the command line utility is quite consistent with Windows Server 2008 R2 or Windows 7 ftp.exe.

To start it ftp.exe, you need to call the dialog box Perform"And dial fTP.. The client will display the invitation string in the team interpreter cmd.exe. And immediately will be ready to work:

FTP.exe utility as a tool for working with FTP servers-01Sintaxis ftp.exe It is very simple and described in detail in the built-in help, which can be caused by the team help.:

In the help system ftp.exe There are brief descriptions of all teams. Their call is carried out by the team help.. Let's see, for example, what makes the team dir.. To do this, type help dir.:

Let's try to connect to some FTP server. Let it be linuxcenter.ru. Team will help us in this open Linuxcenter.ru.:

After connecting to the FTP server, you must inform it in which mode we will work with it. The modes are only two: port-Mode Channel and passive-Mode Data Channel. In 99 cases from 100 used passive mode (more about differences will say Wikipedia), we inform the server that we are not an exception to the rules command qUOTE PASV.:

Now we can proceed to perform data operations: go to the directory structure and display their listings, implement Upload and download files, change the data sent formats, etc. However, FTP servers are different. Therefore, first will be less familiar with the syntax supported by the remote server. There is a team for this. remotehelp.:

To close the active connection, use the command close, to exit ftp.exe - quit.. AND help. To help you. That's how else you can work with the FTP server. Website material

The FTP protocol is one of the common network protocols used by Internet users. The overwhelming number of people is used to roll out anything from FTP servers, various FTP clients. But not many know that the possibility of connecting to FTP servers from the command line is available in Windows.

From this board you will learn how download files from FTP servers using simple DOS commands.

In order to download file with FTP from the Windows command line, Perform a few simple actions:

  1. Open the Windows command prompt by clicking on the Start - Run, typing CMD and clicking on ENTER.
  2. Run the following command: With this command, we will connect to the Microsoft FTP server.
  3. Enter the name of the user Anonymous. The server of this well-known company allows you to connect to anonymous users:
  4. As a password, we enter e-mail (you can enter non-existent):
  5. Congratulations on a successful entrance!
  6. In order to see which files and directories are available on the FTP server, enter the DIR command:
  7. As a result, we receive a list of files and directories located on the FTP server:
  8. In order to go to the required directory, use the CD command:
  9. The message "250 CWD COMMAND SUCCESSEFUL" will say that we have successfully switched to the directory we need:
  10. In order to download the file you need, we enter the Get command and the name of the downloaded file:
  11. After successful file receipt, the system will notify us:
  12. In order to leave the FTP server and disconnect from it, execute the BL command:

Perhaps many will say that it is much more convenient to download files using multifunctional download managers or FTP clients .. but if necessary (or alternatively), you can use simple DOS-teamthat allow you download Files with FTP No additional costs.

And today we will look at work with the FTP server via the CMD command line. As I said, this method is used quite rarely, at least me, as it is easier to work through the FTP client. However, for writing automated scripts to exchange data between your local machine and the FTP server, these knowledge will be very useful to you.

In this video, writing the script we will not, we will deal with this in the next video, and simply consider the basic commands to work with the FTP server through the command line.

Basic commands to work with the FTP server via the CMD command prompt

And first, we need to run the command line ( Start \\ Applications \\ Utilities \\ Command Line) or Win + R \\ Cmd.

First of all, you need to go to the operation mode with the FTP server is done through the command FTP.

We enter USERNAME which has access to this server and PASSWORD

If we are conducting a team Dir. Now we will withdraw a list of files and folders that are contained on the FTP server.

I will not tell about all the commands that are used to work with the FTP server through the command line, but only those that we need to write a script. Mainly, these are commands that allow you to copy files from the FTP server to our local computer and vice versa from the local computer to the FTP server.

You can always type the command. Help. And you will withdraw a list of supported commands to find out the destination of the command to enter Help Title_communications.

But, here the description is very modest, so if you want to learn more detailed description of various teams, go to me on the site to the thematic article. I will post the link in the description of this video.

I do not have access to directly recording files to the root of this FTP server, but there is access to the HTDOCS folder, so to begin with, then let's go to this folder. This is done by the team CD name_name.

We see that in this folder we have nothing. Let's try to copy some file from our local computer here. To do this, we will create a daddy on a local computer, let me say it will nod32_update. Since in one of the following videos, I will talk about how to write a script to automatically update the NOD32 antivirus. And let's create some text document permissible 123.txt.

To copy the 123.txt file to the FTP server enter the command PUT C: \\ NOD32_UPDATE \\ 123.TXT. The file is copied, we can check this command Dir.. As you see, the file was copied precisely in that folder in which we switched through the command CD.

If we need to copy all files from a specific folder on the local computer to the folder on the FTP server, then we need to specify the current local directory and directory on the server.

The directory on the server we learned to indicate through the command CD

Local directory is indicated through the command LCD.If we type it, we will see that the current directory is a folder with the profile of the current user. And since I am going to copy files from another folder, I enter the command LCD Path_K_NU_Papka

What is the essence, there is a team Mpt. Which copies files from the local folder to the remote and it does not request which folders that are, so we need to report this information.

In order to copy all the files from the local folder to the remote I specify the command. MPUT *. *where *.* Means all files located in the local folder.

Here we ask a confirmation issue for each file Want to copy it or not for this we live ENTER. So that such confirmation is not displayed there is a team Promt. Disables the interactive mode off.

Now let's try to make the opposite action, namely copy all the files from the remote folder on the FTP server to the local. This is done through the command MGET *. *.

As you can see everything perfectly, all the necessary files have appeared in our folder and now we can finish working with the FTP server through the command. Quit..