DEV Community

Victor James
Victor James

Posted on • Originally published at windowscmd.com on

FTP

FTP

FTP

This command is for File Transfer Protocol. This command-line tool is transfers files from a computer executing a ftp server service.

CMD Line

CMD Line is a text-based interface that transfers the command from the user to the OS.

CLI-Command Line Interpreter

The command-line interpreter (CLI) for windows is CMD.EXE. Also, you can use PowerShell which can automize many system administration tasks and these tasks are not approachable in command prompt. With the help of the CLI, you can communicate with your system by typing the text in commands. As a result, your system answers to the text that you have typed previously, and then the user can proceed with the next command line that shows up.

To open the Run command Window

Run command window helps you to run programs, open the files and folders. And there are several ways to open up the run command dialog box. This run command box is useful for you to head straight to the destined program easily.

By using the Keyboard shortcut Key:

WINDOWS+R

The shortcut key method to the run command box is the most commonly used one. Also, this method is in all versions of Windows. You need to press the Windows+ R key concurrently to open the Run command dialog box.

Run command box
Run command box

What does FTP command?

This command is to transfer files from a computer executing a file transfer protocol. The ftp means File Transfer Protocol. Let see in detail with syntax and examples.

Syntax


FTP [-options] [-s:filename] [-w:buffer] [host]

Enter fullscreen mode Exit fullscreen mode

Parameter Explanations

  • -s:filename – Runs a text file containing file transfer protocol commands.
  • host – Specifies the Host name or IP address of the remote host.
  • -g – Disables filename wildcards.
  • -nNo auto-login.
  • -iNo interactive prompts during ftp.
  • -v – Hides remote server responses.
  • -w:buffer – Sets buffer size to buffer , default=4096.
  • -dDebug
  • -a – Uses any local interface when binding data connection.

Commands

The following are the commands for FTP: prompt

  • append local-file [remote-file]– Append a local file to a file on the remote computer.
  • ascii – Sets the file transfer type to ASCII , the default. In ASCII text mode, character-set and end-of-line characters are changed as required.
  • bell – Toggle a bell to ring after each command. By default, the bell is off.
  • binary- Set the file transfer type to binary. Use `Binary’ for transferring executable program files or binary data files, e.g., Oracle.
  • bye – Ends the FTP session and exit ftp.
  • cd – Modifies the working directory on the remote host.
  • close – Ends the FTP session and return to the cmd prompt.
  • debugToggle debugging.
  • delete remote-fileDeletes the file on remote host.
  • dir [remote-directory] [local-file]– List a remote directory’s files and subdirectories.
  • disconnectDisconnects from the remote host , retaining the ftp prompt.
  • get remote-file [local-file]– Copies a remote file to the local PC.
  • glob – Toggle the use of wildcard characters in local path names. By default, globbing is on.
  • hash – Toggle printing a hash (#) for each 2K data block transferred. By default, hash mark printing is off.
  • help [command]– Display help for ftp command.
  • lcd [directory]– Change the working directory on the local PC.
  • literal argument […]Send arguments , as-is, to the remote FTP host.
  • ls [remote-directory] [local-file]– Lists a remote directory’s files and folders.
  • mdelete remote-files […]– Delete files on remote host.
  • mdir remote-files […] local-file– Display a list of a remote directory’s files and subdirectories. Mdir allows you to specify multiple files.
  • mget remote-files […]– Copy multiple remote files to the local PC.
  • mkdir directory- Creates a directory on the remote host.
  • mls remote-files […] local-file– List a remote directory’s files and folders.
  • mput local-files […]– Copies multiple local files to the remote host.
  • open computer [port]– Connects to the specified FTP server.

More Commands

  • prompt – Toggle prompting. Ftp prompts during multiple file transfers to allow you to selectively retrieve or store files. By default, prompting is on.
  • put local-file [remote-file]– Copies a local file to the remote host.
  • pwd – Print Working Directory.
  • quit – End the FTP session with the remote host and exit ftp.
  • quote argument […]– Send arguments , as-is, to the remote FTP host.
  • recv remote-file [local-file]– Copies a remote file to the local PC.
  • remotehelp [command]– Display help for remote commands.
  • rename filename newfilenameRename remote files.
  • rmdir directory – Deletes a remote directory.
  • send local-file [remote-file]– Copy a local file to the remote host.
  • status – Display the current status of FTP connections and toggles.
  • trace – Toggles packet tracing , trace displays the route of each packet.
  • type [type-name]– Set or display the file transfer type:
    • If type-name is not specified, the current type is displayed.
    • ASCII should be used when transferring text files.
    • In ASCII text mode, character-set and end-of-line characters are changed as needed.
    • Use ` Binary ‘ for transferring executable files.
  • user user-name [password] [account]– This key specifies a user to the remote host.
  • verbose – Toggle verbose mode. By default, verbose is on.
  • ! command – To run command on the local PC.
  • ? [command]– Displays help for ftp command.

Examples

  • In order to connect to the speed test , FTP server as ‘Marcus’ and with a null password use

C:\> ftp speedtest.tele2.net
User: Marcuss
Password:
230 Login successful.
ftp>

Enter fullscreen mode Exit fullscreen mode
  • This is an example FTP Script to retrieve files in binary and then ASCII mode

::GetFiles.ftp

   [User_id]
   [ftp_password]
   binary
   get /usr/file1.exe
   get file2.html
   mget *.jpeg
   ascii
   mget *.txt
   quit

Enter fullscreen mode Exit fullscreen mode
  • In order to run the script given above use

FTP -s:GetFiles.ftp [hostname]

Enter fullscreen mode Exit fullscreen mode
  • And this will connect as the user: User_id with password:ftp_password

  • To publish files in binary mode, use


::PutFiles.ftp

   [User_id]
   [ftp_password]
   binary
   mput *.html
   cd images
   mput *.gif
   quit

Enter fullscreen mode Exit fullscreen mode
  • In order to execute the above script

FTP -s:PutFiles.ftp [hostname]

Enter fullscreen mode Exit fullscreen mode

This will connect as the user: User_id with password:ftp_password

Windows GUI for FTP

The Windows Explorer (WE) also has a built-in basic FTP client, suitable only for small files.

  • To enable it , follow these steps

Control Panel > Internet Options > Advanced, then click to enable FTP folder view and Use Passive FTP

  • Type in the address bar

ftp://username@ftpserver.address.com

  • If there is any password , you will be prompted

ftp://speedtest.tele2.net

Verdict

Hope through this article you get to know about the FTP command. If you have any suggestions or questions regarding this article, let us know in the comment section, we will update it to you shortly.

Related articles

  • FORFILES The FORFILES command-line tool is to execute a command on a file or set of files. This command was executed mostly in batch files.
  • FORMAT The FORMAT windows command line is for formatting a disk. To format a disk for the use of Windows.
  • FTP The FTP stands for File Transfer Protocol. This command-line tool is transfers files from a computer executing an FTP server service.
  • GPUPDATE The GPUPDATE windows command-line tool is used to update the Group Policy settings.
  • FTYPE The FTYPE windows command-line tool is to display or else changes File type utilized in extension file associations. FTYPE is an Internal command.

The post FTP appeared first on Windows Commands- SS64 Commands.

Discussion (0)