Команда ftp
Для обмена файлами с FTP-сервером используется команда ftp, вот ее синтаксис:
FTP [-v] [-d] [-i] [-n] [-g] [-s:имя_файла] [-a] [-A] [-x:sendbuffer][-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [узел]
| -v | Отключение вывода на экран ответов с удаленного сервера. |
| -n | Отключение автоматического входа при начальном подключении. |
| -i | Отключение интерактивных запросов при передаче нескольких файлов. |
| -d | Включение отладочного режима. |
| -g | Отключение глобализации имен файлов (см. команду GLOB). |
| -s:имя_файла | Задание текстового файла, содержащего команды FTP, которые будут выполняться автоматически при запуске FTP. |
| -a | Использование локального интерфейса для привязки соединения. |
| -A | Анонимный вход в службу. |
| -x:send sockbuf | Переопределение стандартного размера буфера SO_SNDBUF (8192). |
| -r:recv sockbuf | Переопределение стандартного размера буфера SO_RCVBUF (8192). |
| -b:async count | Переопределение стандартного размера счетчика async (3) |
| -w:windowsize | Переопределение стандартного размера буфера передачи (65535). |
| узел | Задание имени или адреса IP удаленного узла, к которому необходимо выполнить подключение. |
Как видно, здесь нет операторов для подключения к серверу и работы с файлами. Дело в том, что эта команда только запускает сеанс ftp:
Далее, работа с FTP-сервером происходит уже при помощи следующих операторов (пропустить) :
Пример bat-файла для загрузки файла на FTP
Теперь попробуем написать «батник» для загрузки файлов на FTP-сервер. Для этого создадим новый текстовый документ, и переименуем его в put_on_ftp.bat . Редактировать его можно обычным Блокнотом, но удобнее это делать с помощью бесплатной программы Notepad .
Connect using ftp
To connect to another computer using FTP at the MS-DOS prompt, command line, or Linux shell, type FTP, and press Enter. Once in FTP, use the open command to connect to the FTP server, as shown in the following example.
File transfer protocol (ftp), a list of ftp commands
| File Transfer Protocol A List of FTP Commands |
The following information is provided as a reference for the File Transfer Protocol (FTP) commands. This document describes and demonstrates the client processes for an interactive and a scripted FTP session. Both the interactive and scripted processes were tested on a Windows System and a Linux (Ubuntu 16.04) System connecting to a UNIX FTP Server. This process may vary slightly depending on the hardware and software configurations of the local and remote systems.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2022
SimoTime Technologies and Services
All Rights Reserved
This section describes a typical process for an interactive and automated, batch FTP session running on a Windows System and connecting to a UNIX System. This process may vary slightly depending on the hardware and software configurations of the local and remote systems.
To start an FTP interactive session type “ftp” from a DOS Command window.
C:> ftp The DOS prompt should be replaced with the FTP prompt. The FTP program is now running on the local system. A connection (or session) to a remote system has not been established.
The help command or ? (question mark) may be executed without being attached to a remote system and will do a print (usually to the screen) of the FTP commands. The following is an example of an FTP Command to display the FTP Help information.
ftp helpThe following is a typical result of the help command running on a PC with Windows.
Commands may be abbreviated. Commands are:
! delete literal prompt send
? debug ls put status
append dir mdelete pwd trace
ascii disconnect mdir quit type
bell get mget quote user
binary glob mkdir recv verbose
bye hash mls remotehelp
cd help mput rename
close lcd open rmdirftpThe following FTP Command will perform the FTP OPEN (make the connection) and display the following messages.
ftp open domain.nameConnected to domain.name 220 antigonous FTP server ready. User (domain.name:(none)): User-Name 331 Password required for user-name Password: password 230 User user-name logged in.ftp
The following FTP Command will change the directory on the remote system and display the following message.
ftp> cd /web250 CWD command successful.ftp
The following FTP Command will find out the pathname of the current directory on the remote system and display the information.
ftp> pwd257 "/web" is the current directory.ftp
The following FTP Command will set the file transfer mode to ASCII (this is the default for most FTP programs) and display the information.
ftp> ascii200 Type set to A.ftp
The following FTP Command will copy a file(using ASCII mode) from the local system to the remote system and display the information.
ftp> put d:simoweb1filename.txt200 PORT command successful. Opening ASCII mode data connection for filename.txt 226 Transfer completeftp
The following FTP Command will set the file transfer mode to BINARY (the binary mode transfers all eight bits per byte and must be used to transfer non-ASCII files) and display the information.
ftp> binary200 Type set to I.ftp
The following FTP Command will copy a file (using BINARY mode) from the local system to the remote system and display the information.
ftp> put d:simoweb1filename.zip200 PORT command successful. Opening BINARY mode data connection for filename.zip 226 Transfer completeftp
The following FTP Command will exit the FTP environment (same as “bye”) and display the information.
ftp> quit221 Goodbye.
When the preceding FTP Command is finished the DOS prompt will be displayed.
C:>
The preceding is a typical process for an interactive FTP session running on a PC with Windows/XP or Windows/7 and connecting to a UNIX system. This process may vary slightly depending on the hardware and software configurations of the local and remote systems.
The following batch file (FTPSAME1.cmd) will start an FTP session and pass the name of a text file (UPWIP001.TXT) to the FTP program. This text file will be processed by the FTP program and each of the statements in the text file will be processed in the sequence they appear.
@echo OFFrem * ******************************************************************* rem * FTPSAME1.CMD - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2022 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * *******************************************************************echo * echo * This batch and text file illustrate the use of FTP to upload an echo * ASCII file and an EBCDIC or Binary file. The UPWIP001.BAT file echo * references UPWIP001.TXT that contains... echo * echo * user echo * password echo * cd /web echo * pwd echo * ascii echo * put d:simoweb1cbltxn01.htm echo * binary echo * put d:simoweb1cbltxn01.zip echo * quit echo * ftp -s:upwip001.txt www.simotime.com
The following is a listing of the contents of the text file (UPWIP001.TXT).
user
passwordcd /web
pwd
ascii
put d:simoweb1cbltxn01.htm
binary
put d:simoweb1cbltxn01.zip
quitThis section describes a typical process for an interactive and automated, batch FTP session running on a Windows System and connecting to a UNIX System. This process may vary slightly depending on the hardware and software configurations of the local and remote systems.
To start an FTP interactive session type “ftp” from a DOS Command window.
C:> ftp The DOS prompt should be replaced with the FTP prompt. The FTP program is now running on the local system. A connection (or session) to a remote system has not been established.
The help command or ? (question mark) may be executed without being attached to a remote system and will do a print (usually to the screen) of the FTP commands. The following is an example of an FTP Command to display the FTP Help information.
ftp helpThe following is a typical result of the help command running on a PC with Windows.
Commands may be abbreviated. Commands are:
! delete literal prompt send
? debug ls put status
append dir mdelete pwd trace
ascii disconnect mdir quit type
bell get mget quote user
binary glob mkdir recv verbose
bye hash mls remotehelp
cd help mput rename
close lcd open rmdirftpThe following FTP Command will perform the FTP OPEN (make the connection) and display the following messages.
ftp open domain.nameConnected to domain.name 220 antigonous FTP server ready. User (domain.name:(none)): User-Name 331 Password required for user-name Password: password 230 User user-name logged in.ftp
The following FTP Command will change the directory on the remote system and display the following message.
ftp> cd /web250 CWD command successful.ftp
The following FTP Command will find out the pathname of the current directory on the remote system and display the information.
ftp> pwd257 "/web" is the current directory.ftp
The following FTP Command will set the file transfer mode to ASCII (this is the default for most FTP programs) and display the information.
ftp> ascii200 Type set to A.ftp
The following FTP Command will copy a file(using ASCII mode) from the local system to the remote system and display the information.
ftp> put d:simoweb1filename.txt200 PORT command successful. Opening ASCII mode data connection for filename.txt 226 Transfer completeftp
The following FTP Command will set the file transfer mode to BINARY (the binary mode transfers all eight bits per byte and must be used to transfer non-ASCII files) and display the information.
ftp> binary200 Type set to I.ftp
The following FTP Command will copy a file (using BINARY mode) from the local system to the remote system and display the information.
ftp> put d:simoweb1filename.zip200 PORT command successful. Opening BINARY mode data connection for filename.zip 226 Transfer completeftp
The following FTP Command will exit the FTP environment (same as “bye”) and display the information.
ftp> quit221 Goodbye.
When the preceding FTP Command is finished the DOS prompt will be displayed.
C:>
The preceding is a typical process for an interactive FTP session running on a Linux System and connecting to a UNIX Server. This process may vary slightly depending on the hardware and software configurations of the local and remote systems.
The following Bash Script File (ftpwips1.sh) is a batch job that will upload multiple web members from the local system to the web server.
#!/bin/bash shname=zuploadRESULTSREQ sh simonote.sh "Starting CmdName $shname" export HOST=domain_name USER=user_id PASS=password sh simonote.sh "Continue with FTP Upload to $HOST" sh simonote.sh "Please wait..."# * ftp -n -v <<FTP_SCRIPT open $HOST quote USER $USER quote PASS $PASS cd / cd /$HOST/public pwd ascii put SIMOWEB1/cblbit01.htm /simotime.com/public/cblbit01.htm put SIMOWEB1/cblivp01.htm /simotime.com/public/cblivp01.htm put SIMOWEB1/ftp4cmd1.htm /simotime.com/public/ftp4cmd1.htm put SIMOWEB1/lorxor01.htm /simotime.com/public/lorxor01.htm put SIMOWEB1/sys76p01.htm /simotime.com/public/sys76p01.htm quit FTP_SCRIPT# * sh simonote.sh "Finished CmdName $shname" exit 0
The following is a summary of the commonly used FTP Commands.
| ||||
? | Request assistance or information about the FTP commands. This command does not require a connection to a remote system. | |||
ascii | Set the file transfer mode to ASCII (Note: this is the default mode for most FTP programs). | |||
bell | Turns bell mode on / off. This command does not require a connection to a remote system. | |||
binary | Set the file transfer mode to binary (Note: the binary mode transfers all eight bits per byte and must be used to transfer non-ASCII files). | |||
bye | Exit the FTP environment (same as quit). This command does not require a connection to a remote system. | |||
cd | Change directory on the remote system. | |||
close | Terminate a session with another system. | |||
debug | Sets debugging on/off. This command does not require a connection to a remote system. | |||
delete | Delete (remove) a file in the current remote directory (same as rm in UNIX). | |||
dir | Lists the contents of the remote directory. The asterisk (*) and the question mark (?) may be used as wild cards. | |||
get | RemoteName LocalName | |||
help | Request a list of all available FTP commands. This command does not require a connection to a remote system. | |||
lcd | Change directory on your local system (same as CD in UNIX). | |||
ls | List the names of the files in the current remote directory. | |||
mget | Copy multiple files from the remote system to the local system. Note: You will be prompted for a “y/n” response before copying each file. | |||
mkdir | Make a new directory within the current remote directory. | |||
mput | Copy multiple files from the local system to the remote system. (Note: You will be prompted for a “y/n” response before copying each file). | |||
open | Open a connection with another system. | |||
put | Copy a file from the local system to the remote system. | |||
pwd | Find out the pathname of the current directory on the remote system. | |||
quit | Exit the FTP environment (same as “bye”). This command does not require a connection to a remote system. | |||
rmdir | Remove (delete) a directory in the current remote directory. | |||
trace | Toggles packet tracing. This command does not require a connection to a remote system. |
A List of FTP Commands
The DIR command will list the contents of the remote directory. The asterisk (*) and the question mark (?) may be used as wild cards.
| ||||
b*n* | This will display all entries that start with the letter “b” and have the letter “n” somewhere after the letter “b”. For example, the following will be displayed. ben, bingo, born, boon, bipartisan, bandit The following will not be displayed. bet, boy | |||
b?n | This will display all entries that start with the letter “b”, have the letter “n” in the 3rd position and have a three character name. For example, the following will be displayed. ben The following will not be displayed. bet, bingo, born, boon, bipartisan, bandit, boy | |||
b?n* | This will display all entries that start with the letter “b” and have the letter “n” in the 3rd position. For example, the following will be displayed. ben, bingo, bandit The following will not be displayed. bet, born, boon, bipartisan, boy |
A List of Parameters for the DIR FTP Command
The following are additional commands that are used when transferring files between an IBM Mainframe and a Windows or UNIX client system. Also, the following includes commands required when working with files containing variable length records.
| ||||
locsite | LOCSITE This statement may be used at the mainframe for commands specific to the mainframe | |||
quote | Will send an argument to the remote FTP Server. This statement is similar in purpose as the “LITERAL” statement. | |||
site | This parameter is used at the client system to transfer a function (via the LITERAL or QUOTE statement) to the host site. The following is a summary of the commonly used SITE/LOCSITE Commands. |
A List of Extended FTP Commands
This SITE (via the literal or quote command) statement is used at the client system and the LOCSITE command is used at the host system. Both statements are used to transfer a function to the host site. The following is a summary of the commonly used SITE/LOCSITE Commands.
CYLINDERS | CYlinders To indicate that space should be allocated in cylinders |
DIRECTORY | DIrectory=nnn where ‘nnn’ indicates the number of directory blocks to be allocated for the directory of a PDS |
LRECL | LRecl=nnn where nnn is the logical record length (LRECL) |
PRIMARY | PRImary=nnn where nnn indicates the number of primary space units (tracks or cylinders) |
RDW | RDW will cause each record of a variable length record to be preceded with a four byte Record Descriptor Word (RDW) and possible four byte Block Descriptor Word (BDW). |
RECFM | RECfm=format where format is: F, FA, FB, FBA, FBM, FM, U, V, VA, VB, VBA, VBM, or VBS |
SECONDARY | SECondary=nnn where nnn indicates the number of secondary space units (tracks or cylinders) |
TRACKS | TRacks To indicate that space should be allocated in tracks. |
Parameters used with the LOCSITE Extended FTP Commands
The following is an example of the LITERAL command and a GET command. The commands are executed at the client and will cause the RDW (Record Descriptor Word) to be included at the beginning of each record of a file with variable length records.
LITERAL SITE RDW
GET host-file-name client-file-nameThe following is an example of the LOCSITE command and a PUT command. The commands are executed at the host and will cause the RDW (Record Descriptor Word) to be included at the beginning of each record of a file with variable length records.
LOCSITE RDW
PUT host-file-name client-file-nameThe following is an example of the LOCSITE command for accessing tape files with variable length recoerds. The command is executed at the host and will cause the RDW (Record Descriptor Word) to be included at the beginning of each record of a file with variable length records.
LOCSITE RDW READTAPEFORMAT=V
PUT host-file-name client-file-nameThe purpose of this document is to provide a quick reference for connecting and exchanging information between two systems. This document describes a typical process for an interactive or automated, batch File Transfer Protocol (FTP) session running on a PC with Windows/2000 and connecting to a UNIX system. This process may vary slightly depending on the hardware and software configurations of the local and remote systems.
This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.
In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact, Comment or Feedback section of this document.
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.
SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided “AS IS” without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an Internet connection, the second group of documents will require an internet connection.
Note: A SimoTime License is required for the items to be made available on a local system or server.
The following links may be to the current server or to the Internet.
Note:The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the
icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the
icon.
![]()
![]()
Explore Sample FTP Scripts and Windows Command Files(FTP) that will transfer files between a Mainframe Host System and a Windows Client System.
![]()
![]()
Explore the alternatives for transferring data files between systems. This link provides access to a repository of information that includes the transferring and/or sharing of data between Mainframe (ZOS or VSE), Linux, UNIX and Windows Systems.
![]()
![]()
Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.
![]()
![]()
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an Internet connection.
A good place to start is
The SimoTime Home Page
for access to white papers, program examples and product information. This link requires an Internet Connection
Explore
The Micro Focus Web Site
for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore
the GnuCOBOL Technologies
available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require an Internet Connection.
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
This document was created and is maintained by SimoTime Technologies and Services. If you have any questions, suggestions, comments or feedback please use the following contact information.
1. | Send an e-mail to our helpdesk. |
2. | Our telephone numbers are as follows. |
2.1. | 1 415 763-9430 office-helpdesk |
2.2. | 1 415 827-7045 mobile |
We appreciate hearing from you.
SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today’s environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.
Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.
Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.
Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.msconfig.ru
Ftp commands
Depending on the version of FTP and the operating system, each of the following commands may or may not work. Typing -help or a ? lists the commands available to you. Below is a general description of FTP commands available in the Windows command line FTP command.
Загрузка файла на сервер
Чтобы загрузить файл, введите команду:
положить имя файла
Теперь вы можете просмотреть загруженный файл, введя URL, таким образом:
Сообщите мне, если у вас есть какие-либо вопросы.
Утилита ftp.exe как инструмент для работы с ftp-серверами | настройка серверов windows и linux
Обновлено 12.04.2022

Всем привет сегодня расскажу про утилиту ftp.exe как инструмент для работы с FTP-серверами.
Для работы с FTP-серверами вовсе необязательно использовать громоздкие (и иногда не бесплатные) FTP-клиенты, для простейших операций вполне сгодится входящая в состав ОС Windows server 2008 R2 или Windows 7 утилита командной строки ftp.exe.
Чтобы запустить ftp.exe, нужно вызвать диалоговое окно «Выполнить» и набрать ftp. Клиент выведет строку приглашения в командном интерпретаторе cmd.exe и сразу будет готов к работе:

Утилита ftp.exe как инструмент для работы с FTP-серверами-01Синтаксис ftp.exe очень прост и достаточно подробно описан во встроенной справке, которую можно вызвать командой help:
В справочной системе ftp.exe существуют краткие описания всех команд. Их вызов осуществляется командой help. Посмотрим, например, что делает команда dir. Для этого наберем help dir:
Попробуем установить соединение с каким-нибудь ftp-сервером. Пусть это будет linuxcenter.ru. В этом нам поможет команда open linuxcenter.ru:
Сервер потребует авторизоваться. Так как это публичный сервер, то мы можем использовать анонимный вход. Регистрируемся как anonymous с пустым паролем:
После подключения к ftp-серверу необходимо сообщить ему, в каком режиме мы будем с ним работать. Режимов всего два: port-mode channel и passive-mode data channel. В 99 случаях из 100 используется пассивный режим (подробнее о различиях скажет Википедия), сообщаем серверу, что мы не исключение из правил, командой quote PASV:
Теперь мы можем приступать к выполнению операций с данными: переходить по структуре каталогов и выводить их листинги, осуществлять upload и download файлов, менять форматы пересылаемых данных и пр. Однако, ftp-серверы бывают разными. Поэтому сперва будет нелишним ознакомиться с синтаксисом, поддерживаемым удаленным сервером. Для этого есть команда remotehelp:
Чтобы закрыть активное соединение, используйте команду close, для выхода из ftp.exe — quit. И help вам в помощь. Вот так вот еще можно работать с ftp сервером. Материал сайта msconfig.ru
Send and receive a file in ftp
To get files from the server onto your computer, use the get command, as shown in the following example. In this example, you would get the file myfile.htm.
get myfile.htm
Use the send command, as shown in the following example, to move a file to another connected computer. In this example, we are sending the myfile.htm to the current directory.
send myfile.htm
It is important to realize that the files sent must be in your local working directory. In other words, the directory you were in when you typed the FTP command. If you want to change to the local directory containing your files, use the lcd command. For example, in Windows, you’d type lcd c:windows to set the local directory to the Windows directory.



