How to upload files to the server via FTP? The best way to transfer files via FTP with FileZilla Sending via ftp.

FTP ( File Transfer Protocol) is the most popular protocol for transferring files (download and upload) from one system to another system. This provides a fast way to transfer files. There are many applications available on Linux and Windows such as VSFTPD, ProFTPD for Linux, FileZilla Server for windows and macOS.

Eat various ways I use a graphical environment to connect to the FTP server, but system administrator must know the power command line. And in this topic “Download and upload files via FTP using the console” I will tell you how you can work with the command line to transfer/receive data.

1. Connect to an FTP server using the command line

To connect to any server using the command line, use the terminal.

$ ftp ftp.site

2. Upload file to FTP server

To upload a file to the server use FTP put. First, you need to go to the desired folder on the FTP server to upload the file and use the following command.

Ftp> cd uploads ftp> put /home/captain/my_file.txt

3. Download one file from FTP server

To download a file from an FTP server, we use the get command. Using this command we can download one file. To download any file from FTP server, first login to the FTP server, then go to the directory and use the following command to download any file:

Ftp> get my_file.txt

4. Upload multiple files to FTP server

To upload multiple files to an FTP server we use the MPUT command. We can specify a wildcard character to upload multiple files to the server at the same time. Firstly go to the desired folder on the FTP server to upload the file and use the following command. It will upload all files with .txt extension to the /home/captain directory for uploaded files on the FTP server.

Ftp> cd uploads ftp> lcd /home/captain/ ftp> put *.txt

5. Download multiple files from FTP server

To download multiple files from an FTP server, we use the MGET command. Using this command you can upload files.

Ftp> mget *.txt

Teams.

!
Exit shell

?
Print help about local information

append
Add to file

ascii
Set the transfer type to ASCII. Use this to transfer text files (HTM files).

bell
Sound signal when command completes.

binary
Set the transfer type to binary. Use this to transfer binary files (XE files and graphics).

bye

CD
Change remote working directory (use ".." to change to parent).

close
End the FTP session.

delete
Delete the deleted file.

debug
Switch debug mode.

dir
List (show) the contents of a remote directory.

disconnect
End the FTP session.

get
Get a file (see also mget).

glob
Switch extension metacharacter from local filename.

hash
Toggle printing '#' for each buffer passed.

help
Show a list of commands.

lcd
Change local working directory.

literal
Send a custom FTP command.

ls
Show the contents of a remote directory.

mdelete
Deleting multiple files.

mdir

mget
Get multiple files (see also get)

mkdir
Create a directory on the remote machine.

mls
List the contents of several remote directories.

mput
Send multiple files (see also put).

open
Connect to remote FTP.

prompt
Rough interactive prompt on multiple teams (this is a switch)

put
Send one file (see also mput).

pwd
Print working folder(where you are now) on a remote machine.

quit
End the connection session and work.

quote
Send a custom FTP command. You can view a list of raw FTP commands at www.nsftools.com/tips/RawFTP.htm

recv
Receive file

remotehelp
Get help from remote server

rename
Get file.

rmdir
Delete a directory on a remote machine.

send
Send one file.

status
Show current status.

trace
Toggle packet tracing.

type
Set transfer file type

user
Send new user information.

verbose
Toggle verbose mode.

The topic “Download and upload files via FTP using the console” is completed.

It is often necessary to automate the processes of downloading, uploading and deleting files from an FTP server. For example, when working with distributed databases 1C data or to save backup copies. But not everyone knows that these procedures can be performed from the command line without resorting to additional software, that is Windows tools. Below I will provide the command syntax for working with FTP, as well as examples of bat files for these operations.

1.ftp command

To exchange files with an FTP server, use the ftp command, here is its syntax:

FTP[-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer]
[-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [node]

-v Disable display of responses from a remote server.
-n Disable automatic login upon initial connection.
-i Disabling interactive requests when sending multiple
files.
-d Enable debug mode.
-g Disable file name globalization (see GLOB command).
-s:filename Exercise text file, containing FTP commands that
will be executed automatically when you start FTP.
-a Using the local interface to bind the connection.
-A Anonymous login to the service.
-x:send sockbuf Override the default buffer size SO_SNDBUF (8192).
-r:recv sockbuf Override the default buffer size SO_RCVBUF (8192).
-b:async count Overriding the default async counter size (3)
-w:windowsize Override the default transmit buffer size (65535).
node Specifying the name or IP address of the remote node,
to which you want to connect.

As you can see, there are no operators for connecting to the server and working with files. The thing is that this command only starts the ftp session:

!
Temporary transition to the shell.

append
Adding to file.

ascii
Setting the transfer mode for files in ascii format.

bell
Issue sound signal upon completion of the command

binary
Set the binary file transfer mode.

bye
End the ftp session and log out.

CD <удаленный_каталог>
Changing the working directory on the remote computer where:
<удаленный_каталог> — the name of the directory that will become working.

close
Ending the ftp session.

debug
Switching debugging mode.

delete <удаленный_файл>
Deleting a file on a remote computer where:
<удаленный_файл> — name of the file to be deleted.

dir [ <удаленный_каталог> ] [<локальный_файл> ]
Listing the contents of a directory remote computer, Where:
<удаленный_каталог>
<локальный_файл>

disconnect
Ending the ftp session.

get <удаленный_файл> [<локальный_файл> ]
Getting a file where:
<удаленный_файл>
<локальный_файл> — file name on local computer .

glob
Switching the metacharacter extension of local file names.

hash
Switches the "#" output for each transferred block of data.

help [ <команда> ]
Display help information for the ftp command, where:
<команда> — The command whose description will be displayed, if not specified, all commands will be output.

lcd [ <локальный_каталог> ]
Changing the local directory of the working computer, where:
<локальный_каталог> — The name of the new local directory; if not specified, the name of the current directory will be used.

literal <команда_1> … <команда_n>

<команда_n> — commands to send;

ls [<remote_directory>] [<local_file>]
Displays the abbreviated contents of the remote computer's directory, where:
<удаленный_каталог> — directory whose contents will be displayed; if not specified, the current directory is used;
<локальный_файл> — specifies a local file to save to the list; if not specified, the list is displayed on the screen.

mdelete<remote_file_1> … <remote_file_n>
Deleting multiple files on a remote computer where:
<удаленный_файл_n> — names of files to delete.

mdir<remote_directory_1> … <remote_directory_n> <local_file>
Print the contents of several directories on a remote computer, where:
<удаленный_каталог_n> — the directory whose contents will be displayed;
<локальный_файл> — specifies a local file to save to the list; if not specified, the list is displayed on the screen.

mget <удаленный_файл_1> <удаленный_файл_n>
Receiving multiple files where:
<удаленный_файл_n> — remote file to copy.

mkdir <удаленный_каталог>
Create a directory on the remote computer where:
<удаленный_каталог> — name of the remote directory to create.

mls<remote_directory_1> ... <remote_directory_n> <local_file>
Print the shortened contents of several directories on a remote computer, where:
<удаленный_каталог_n> — directory whose contents will be displayed; if not specified, the current directory is used;
<локальный_файл> — specifies a local file to save to the list.

mput <локальный_файл_1> … <локальный_файл_n>
Sending multiple files where:
<локальный_файл_n> — the name of the local files that will be copied.

prompt
Toggle interactive tooltip for compound commands.

put <локальный_файл> [<удаленный_файл> ]
Sending one file, where:
<local_file>
<удаленный_файл>

pwd
Displays the working directory of the remote computer.

quit
End the ftp session and exit to the command line.

quote <команда>
Send an arbitrary ftp command, where:
<команда> — command to send.

recv <удаленный_файл> [<локальный_файл> ]
Retrieving a file using the current file type settings, where:
<удаленный_файл> — remote file for copying;
<local_file> — file name on the local computer .

remotehelp [ <команда> ]
Obtaining help information about commands on a remote system, where:
<team> — remote system command; if not specified, a list of all commands is displayed.

rename <имя_файла> <новое_имя_файла>
Renaming remote file, Where:
<file name> — file name to rename;
<new_file_name> — new file name.

rmdir <имя_каталога>
Deleting a directory on a remote computer where:
<directory_name> — name of the directory to delete.

send <локальный_файл> [<удаленный_файл> ]
Copy a single file using the current file type settings, where:
<local_file> - Name local file for copying;
<удаленный_файл> — file name on the remote computer.

status
Displays the current ftp connection status.

trace
Toggle packet tracing.

type [ <имя_типа> ]
Setting the file transfer type, where:
<type_name> — file transfer type; if not specified, the current file transfer type will be displayed.

user <имя_пользователя> [<пароль> ] [<учетная_запись> ]
Send information to connect to a remote computer where:
<username> — username for connecting to the remote computer;
<password> - password for specified name user, if not specified but required for connection, the ftp command will prompt the user for it;
<account_account> — an account for connecting to a remote computer, if not specified but required for connection, the ftp command will ask the user for it;

verbose
Switching the message output mode.


Let's look at a small example.

First, let’s write a “body file” that will upload to the server website file file_data.dat from " C:\example". The algorithm for the bat file will be as follows:

  • Create a transport.txt file with a sequence of ftp statements;
  • We execute the ftp command, specifying the created file as parameters;
  • Delete transport.txt.

IN in this example The file name and directory are hardcoded in the file. This is not always convenient. Let’s modify the bat file so that it receives the data to be loaded as parameters, and we’ll also move all changeable values ​​into file variables. We get the following code ():

Accordingly, to copy the file file_data.dat from " C:\example" to the FTP server in " Temp\Backup", you will need to run this batch file, specifying the file name, local and remote directories as parameters.

In a similar way, you can write bat files for and on an FTP server, as well as an executable file with an arbitrary set of instructions.

Did this article help you?

File Transfer Protocol (FTP) is an Internet protocol that allows users to upload files to FTP server and download them from this server. To use FTP to send and receive files, you need an account on the FTP server. In addition to the current account, you need an FTP client on the computer that connects to the server. Internet Explorer and other web browsers will interact with the FTP protocol. However, other FTP clients provide more high speeds transmission and more functions. Some FTP clients distributed free of charge or shareware are WS_FTP, CuteFTP and FileZilla.

Instructions

  • 1 Download and install one of the FTP clients. (See Sources.)
  • 2 Open an FTP client and click "New Connection."
  • 3 Enter domain name for the FTP server to access it.
  • 4 Enter the user ID and password in the appropriate fields, if required.
  • 5 Click the Connect button. The FTP client will display the FTP server on one panel of the interface, and the files located on your computer on the other.
  • 6 Drag and drop files between the left and right panels (local and remote computer) to transfer to and from the FTP site. =>> Access the FTP site using a browser:
  • 7 Open a web browser and enter the domain name of the FTP site in the address bar. URL links to FTP sites contain the prefix "ftp://" but not "http://."
  • 8 Press Enter. The FTP server login dialog box will open if the FTP site has user account security protection. If the FTP site does not have security settings, the FTP site will be displayed in a view similar to the file tree in Windows Explorer.
  • 9 Drag files from the FTP site to your desktop to upload files, or drag files from your local computer to the FTP site panel to upload them to the site.

And I thought: does everyone know that to work with FTP storages, standard Windows tools? In this article I will describe three simple methods transferring files via FTP using an example. The same techniques apply in . All you need is , Explorer and the command line.

Method one: Internet Explorer 8

Any Internet user is familiar with HTTP addresses for accessing websites that are entered into address bar browser - for example, . Addresses for accessing FTP servers are built according to the same principle: .

Enter your public FTP storage address, such as Microsoft (Figure A), in the address bar and click . If the connection is successful, you will see the root directory. To access subdirectories and files, click on the main directory. To download a file, click on it right click mouse and select the “Save Target As” option.

As you can see, all database articles, patches, updates, utilities and Microsoft documentation are stored on the server, only they are presented in the form of a list with dates. Detailed information about FTP storage is contained in the "readme.txt" files.

Figure A. Microsoft FTP server as seen from Internet Explorer 8.

Please note: to successfully connect to an FTP server using IE, the “Enable FTP folder view (outside of Internet Explorer)” and “Use passive FTP protocol ( Use Passive FTP (for firewall and DSL modem compatibility) in the Browsing section of the Advanced tab of the Internet Options dialog box. You can call it from the “Tools” menu.

To access private FTP servers, you must enter a username and password (Figure B). However, this way in IE 7 or IE 8 you can only view a list of files. To download you will have to use Explorer (Windows Explorer). See Fig. for details. C, D, E and F.


Figure B: A username and password are required to access private FTP servers.


Figure C. Select the “Page | Open FTP site in Windows Explorer"(Page | Open FTP Site in Windows Explorer) or "View | Open FTP Site in Windows Explorer (View | Open FTP Site in Windows Explorer) to launch Explorer.



Figure D: In the Internet Explorer Security Warning dialog box, click Allow.

An FTP connection is used to upload files to the server. It may be needed, for example, to place a web page or PHP script files on the Internet.

To upload files using an FTP connection, you must use special program- FTP client (for example, FileZilla). Before uploading files, establish an FTP connection to the server. To do this, enter the following parameters in the connection properties of the FTP client:

  • FTP server address;
  • username;
  • password.

FTP connection parameters can be obtained from the hosting provider or configured independently in the hosting control panel.

After connecting to the server, you will see in the FTP client window a list of directories and files located on the server. Select the directory where you want to upload the files, then select the files on your computer and start the file upload operation to the server.

In order for files to be accessible via the Internet, they must be uploaded to the server in a directory intended for storing such files. The name of this directory should be confirmed with your hosting provider or server administrator. This directory is often called public_html, www, htdocs or httpdocs.

After uploading to the directory with the name specified above, the files become available on the Internet at an address like http:// your_site.ru/ file name , Where your_site.ru- the domain name of your website, and file name - full name file with extension . For example, if your domain name is mydomain.ru, and the file name is test.html, then after uploading to the server the file will be available at http://mydomain.ru/test.html.

Attention: directory name public_html, www, htdocs or httpdocs is not indicated in the address of the downloaded file!
  • What files store the database connection parameters?
  • How to upload files to the server via FTP?
Share