FTP commands and application examples (with FTP error code control)

xiaoxiao2021-03-06  46

The ftp command is one of the most frequent commands using the Internet user. Whether using FTP under DOS or UNIX operating system, you will have a lot of FTP internal commands, familiar with and flexibly apply the internal commands of FTP, which can be greatly convenient for users. Now dial-up users, if the ISP provides shell to use Nohup, then FTP will be your most money on Download method, FTP command line format is: ftp -v -d -i -n -g [host name]

-V Displays all response information of the remote server.

-D use debugging mode.

-N Limits an automatic login of FTP, ie not .NETRC files.

-G cancels the global file name.

The internal command used by FTP is as follows (where bracket represents optional):

1.! [Cmd [args] Performs interaction shell in the local machine, exit returns to the FTP environment, such as! Ls * .zip.

2. ¥ Macro-AME [ARGS] Perform a macro definition macro-name.

3. Acount [Password] provides the supplementary password required to access the system resource after logging in to the remote system.

4.AppendLocal-file [remote-file] Add a local file to a remote system host. If the remote system file name is not specified, the local file name is used.

5.ASCII uses the ASCII type transmission mode.

6. Bell Each command is executed, the computer rings once.

7.bin uses binary files.

8. Bye exits the FTP session process.

9.case transfers the uppercase of the remote host file name to lowercase letters when using MGET.

10.CD Remote-Dir enters the remote host directory.

11. CDUP enters the parent directory of the remote host directory.

12.chmod modefile-name Sets the way remote-name to Mode, such as Chmod 777 A.out.

13.Close interrupt FTP session with the remote server (corresponding to Open).

14. When CR transmits a file using the ASSCII mode, convert the return line to a back.

15. Delete Remote-file Deletes the remote host file.

16.Debug [debug-value] Setup debug mode, display each command sent to the remote host, such as DEBUP3, if set to 0, indicates canceling the debug.

17.DIR [remote-dir] [local-file] Displays the remote host directory and stores the result to local-file.

18.Disconnection with a Close.

19.Form Format Sets the file transfer mode to Format, defaults to File mode.

20.GetRemote-file [local-file] Transfers the remote host file Remote-File to local-file of the local hard drive.

21.Glob Sets the file name extension of MDelete, MGET, MPUT, and does not extend the file name, the -g parameter with the command line is not expanded.

22. Hash is transmitted 1024 bytes per transmitted, showing an HASH symbol (#).

23.Help [cmd] Displays help information for the FTP internal command CMD, such as Help Get.

24.idle [Seconds] Sets the sleep timer of the remote server to [Seconds] seconds.

25. Setting a binary transmission mode (with binary)

26.LCD [DIR] Switch to DIR of the local working directory.

27.ls [remote-dir] [local-file] Displays the remote directory Remote-Dir and stores local local-file.

28. MacDef Macro-Name Defines a macro, when you encounter a blank line under MacDef, the macro definition ends.

29.mdelete [remote-file] Deletes remote host files.

30. Mdir Remote-Files Local-file is similar to DIR, but multiple remote files can be specified, such as mdir * .o. *. Zipoutfile. 31.Mget Remote-files Transport multiple remote files.

32.mkdir Dir-Name built a directory in the remote host.

33.mls Remote-file local-file with nList, but can specify multiple file names.

34.Mode [Mode-Name] sets the file transfer mode to Mode-name, default is a Stream mode.

35.Modtime file-name Displays the final modification time of the remote host file.

36. MPUT local-file transfer multiple files to the remote host.

37.NewerFile-name retransmit the file if the modification time of the File-Name in the remote machine is closer to the same name file with the local hard disk.

38.nlist [remote-dir] [local-file] Displays the file list of the remote host directory and stores local-file of the local hard drive.

39.NMAP [InPatternOutPattern] Set the file name mapping mechanism, make the file transfer, some characters in the file mutual conversion, such as NMAP ¥ 1. ¥ 2. ¥ 3 [¥ 1, ¥ 2]. [¥ 2, ¥ 3 ], When the files A1 .a2.a3 are transmitted, the file name becomes A1, A2, which is especially suitable for the case where the remote host is non-U-NIX machine.

40.ntrans [Inchars [Outchars] Sets the translation mechanism for file name characters, such as NTRANS1R, the file name LLL will become RRR.

41.Open Host [Port] establishes the specified FTP server connection to specify the connection port.

42. Passive enters the passive transmission method.

43.Prompt Sets the interaction tips when multiple file transfer.

44.ProxyFTP-CMD In the secondary control connection, execute an FTP command, which allows two FTP servers to transfer files between two servers. The first FTP command must be Open to build a connection between the two servers first.

45.Put local-file [remote-file] Transfer local file local-file to the remote host.

46.PWD Displays the current working directory of the remote host.

47.quit with BYE, exit the FTP session.

48. quote Arg1, Arg2 ... Send parameters to remote FTP servers, such as Quote Syst.

49.Recv remote-file [local-file] with get.

50.RegetRemote-file [local-file] is similar to get, but if local-file exists, it is submitted from the last transfer.

51.Rhelp [cmd-name] requests the help of the remote host.

52.RSTATUS [File-Name] If the file name is not specified, the status of the remote host is displayed, otherwise the file status is displayed.

53.Rename [from] [to] Change the remote host file name.

54.Reset Clear the queue.

55.Restart Marker Restart GET or PUT from the specified flag Marker, such as Restart 130.

56.Rmdir Dir-Name Deletes the remote host directory.

57.Runique Settings File Name Unique Store, if the file exists, then add the suffix after the original file.

58.send local-file [remote-file] with the PUT.

59.Sendport sets the use of the port command.

60.Site Arg1, Arg2 ... Send the parameters as the site command to the remote FTP host.

61.Size file-name Displays the remote host file size, such as site idle 7200.62.status displays the current FTP status.

63.Struct [struct-name] sets the file transfer structure to struct-name, using the Stream structure when default.

64. Sunique Set the remote host file name storage to unique (corresponding to Runique).

65.System Displays the operating system type of the remote host.

66.TENEX Sets the file transfer type to the TENEX machine.

67.Tick Set the byte counter at the time of transfer.

68.Trace Setup Package.

69.Type [type-name] Setting the file transfer type to type-name, default is ASCII, such as TypeBinary, set binary transfer mode.

70.umask [newmask] sets the default umask of the remote server to NewMask, such as umask 3.

71.UserUser-name [password] [Account] indicates that your identity is indicated by the remote host, and you must enter a password, such as user anonymous my @ email.

72. Verbose The -v parameter with the command line is set, that is, all responses to the FTP server will be displayed to the user, default is ON.

73.?[cmd] with HELP.

-------------------------------------------------- -------------------------------------------------- ----------------

Simply upload download instance (/ *..../ is a comment):

First assume that there is an FTP server, FTP server: Qint.ITHOT.NET, username: username Password: user1234. In the local computer D: Create a folder "qint". Copy the file to be uploaded to D: / Qint. Upload files from local uploaded files from the server, as follows:

1. "Start" - "Run" - Enter "FTP"

2. Open qint.iTHOT.NET / * This step can be merged with the first step and enter "FTP Qint.ITHOT.NET" directly in "Run". If your FTP server is not using the 21 default port, if the port is 2121, then the command of this step should be added 2121 in the back space, ie "Open qint.iT.NET 2121" * /

3.Username / * Tips You enter your username * /

4. IUSER1234 / * Tip You enter your password, password is not exposed, and then enter the password. If your password is entered, you will not prompt you to re-enter. At this time, you want to type the "User" command, will appear in the third step, you can re-enter the username and password. * /

5.Dir / * You can use the DIR to view the command to view the files and directories in the FTP server, you can only view the file with the ls command. * /

6.mkdir qint / * established a qint directory in the root directory on the FTP server. * /

7.CD qint / * Enter the directory Qint, use "CD Your Directory Name" to enter the next level of the current directory, which is the same as DOS. * /

8.bin / * adopts binary transmission. If you want to upload download, this step is important, don't perform this command first, the upload download will be very slow. * /

9.lcd d: / qint / * Located the local default folder, in front of me in D: disk created in advance. * /

10.! DIR / * View files and directories in the local folder * /

11.Put i001.jpg / * Upload file i001.jpg in the current directory (D: / Qint) to the FTP server default directory. You can use "MPUT *. *" To upload all files to the FTP server. * / 12.Get D123.jpg / * Download the file D123.jpg in the default directory of the FTP server to the current directory (D: / Qint). You can download all files to D: / Qint * / with "MGet *. *".

13.Delete *. * / * Delete all the files in the directory Qint. * /

14.cd .. / * Return to the previous directory, the root directory. Back to the previous directory "CD .." should be noted that there is space in the middle. Returns the root directory "CD /". * /

15.mrdir qint / * Delete the directory Qint. Delete the directory, do not have files and directories in this directory, or you will not be deleted. * /

16.BYE / * exits the FTP server * /

Special attention to the current directory of the server and the local computer when the download is downloaded, where is the problem from where the file is. View the current directory command of the FTP server is a PWD, you can locate the server with the CD command. You can locate the local computer with the LCD command. The above instance is applied to the most common command to download and download the ftp command line, you can also use the command "?" To view more commands.

转载请注明原文地址:https://www.9cbs.com/read-110242.html

New Post(0)