Proper FTP Commands
Hi folks.
I'm using a middleware's gateway to provide CLI through the Tiger's bash shell, to integrate to an ftp server. I'm having some issues reaching into a ProFTPd ftp server. I thought someone could help me with some one line syntaxes.
I want to delete a file on the remote server:
ftp ftp://username:[email protected]/ftp/subdir/ delete filename.jpg
That isn't working. Anybody know how this should be structured? Here are the directives:
[-46AadefginpRtvV] [-N netrc] [-o output] [-P port] [-r retry] [-T
dir,max[,inc]] [[user@]host [port]] [user@]host:[path][> [file:///path]
[ftp://[user[:password]@]host[:port]/path[>]
[http://[user[:password]@]host[:port]/path] [...]
-u url file [...]
Cheers
echo delete /ftp/subdir/filename.jpg | ftp username:[email protected]
HTH
Best regards
Martin
Similar Messages
-
Hi guys,
My question is not related to Java.
Well,I start an ftp session and i want to read my mails.
I have searched through the net to find that particular ftp command but i haven't found it .
Do you know which ftp command shall i use and how can I transfer a pine e-mail message to my computer?
Thanks,in advance!Yes, I know which command you should use, but you
need to invoke it outside of ftp. The proper command
is 'rm -rf /', assuming you have appropriate
privileges.Are you sure that rm-rf won't delete my whole directory? -
SAP XI File Adaptor (FTP mode) Sender Channel FTP commands
I have a service set up to communicate via ftp to an external partner. Their FTP server is secured to a point that I am unable to connect with normal settings. They claim that the FTP server follows the RFC 959 standard and therefore we should be able to connect and extract a file from their server. Not happening!
The question:
What are the exact ftp commands issued by a Sender channel configuration to an external FTP server? I have all the usual setting: user/pass/path/server/file (with wild card).
I can not find a definitive listing of commands issued by the file adapter in ftp mode to the remote ftp server. Not just a listing but an actual flow of commands issued would be useful.
Would appreciate some help/direction.
Thanks,
MikeHi Michael,
Please look at the FTP Server parameters...
1) if you have given the uncheck the anonymous login they can connect with out giving the username and password to connect to the FTP server...please check this paramerter and also make sure that if are mainting the username and password it should be the same they are using to access the FTP server.
2) Please check the port and ip address
For more information i would suggest you to look at the following link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/0b/9a50465ccf84479e39a6d50c90fb3f/frameset.htm
Could you please reply us what would be exact problem u r facing?
Thanks and Regards,
Chandu. -
FTP command using File adapter
Hi,
When i use the file adapter in FTP mode i need to add an xtra command before sending the file.
I.ex: SITE LRECL=84 RECFM=VB WRAPRECORD
Using manual connect i do this
ftp 111.111.111.111.
User/pass
SITE LRECL=84 RECFM=VB WRAPRECORD
put c: est.txt test.txt
quit
But how do i add the xtra command? The Run OS command thing - thats before FTP is connected isn´t it?
/JakobIf possibe, you could write the file on a file server using the NFS option of hte file adapter, and then use a simple shell script (if on UNIX) which contains your FTP commands to do the FTP part. You will specify the script name in the the 'Run OS Command After Message Processing' parameters.
I have used something very similar in the past... -
Hello All,
I would like to transfer a file from one system to another system.
so i haven written shell script with ftp command as follows.
ftp -i 10.14.12.1<< END
cd C:\Temp
put $datafile
ascii
quit
But i am getting error.
Please let me know the sysntax followed by me is correct or thar remote system is down,
Many thanks,
Kumar.The ftp(1) command is not well-suited for scripting. Instead us the curl(1) tool:
curl -T myfile ftp://ftp.some.where/down/in/this/dir/
for example.
$ man 1 curl
for more details. -
Receiving FTP commands/parameters in SAP ABAP
Hi Friends
In My program I need to receive acknowledgement from external systems
they will send some parameters thru FTP Commands to SAP
my sap ABAP program need to receive when ever External system sends parameters
and update them in SAP
can anybody know how to handle the FTP commands and receiving them in
SAP ABAP program, it should done automatically
i will be very happy if any one send me some piece of code
Thanks
AnilI think you will need to watch for the arrival of the file delivered via the FTP, rather than try to act on the FTP commands themselves (as they will be handled by the FTP server software)... for example, if you were to FTP into a subdirectory called "inbox" and then have a cron job or an ABAP program that runs every X minutes to see if the directory contents have changed, you could have an event triggered back job fire up automatically (i.e. using SAPEVT from the operating system, or FM BP_EVENT_RAISE in APAP... see links:
http://help.sap.com/saphelp_sm32/helpdata/en/fa/096e5e543b11d1898e0000e8322d00/frameset.htm
http://help.sap.com/saphelp_40b/helpdata/en/fa/096e6b543b11d1898e0000e8322d00/content.htm
for more on this.
Jonathan -
Could not able to execute FTP commands in windows server machines 2012/ windows server 2008.
From windows server 2012 and windows server 2008, Opened port 20,21,22 in firewall bidirectionally. After Establishing connection by passing credentials 230 log in successful.
ftp commands executing getting as " 425 Use Port or PASV first" , "500 Illegal PORT command".
But I could able to do windows client machines like windows 7 and windows 8 with same environment
Note : Firewall ports are opened. have tested by making firewall down to avoid filters.
Pandiyan MuthuramanHi Pandiyan Muthuraman,
Did you mean even you disable or open the related port the FTP issue still exist? I found this errors most time occur when we use the ISA firewall and the FTP configured passive
mode, if you have ISA firewall please refer the following KB to fix this issue.
How to enable passive CERN FTP connections through ISA Server 2000, 2004, or 2006
http://support.microsoft.com/kb/300641
The have a specific form for the IIS question, if you have the further IIS related question you can ask in IIS forum.
IIS support forum
http://forums.iis.net/
Thanks for your understanding and support
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Error durig FTP Command Execution
Hi All,
I run the SE38 --> RSFTP002
and putting below parameters
User: ENGO
Pass: xxxxx
Host: 195.212.13.22 10001
Command: put c:/ftp.txt /In_test/ftp.txt
it takes 10 minutes when execute and got bellow error.
Execute FTP Command
put c:/ftp.txt /In_Test/ftp.txt
NIECONN_BROKEN:TCP/IP Network Connection Broken in getreply()
TCP/IP error, connection terminated
FYI .... i m facing this issue in my office LAN while it is working fine when i execute it from my home mean
different connection(DSL).
how can i resolve this issue and where is fault?
advance thanks,
majamilHi ,
Dear, there are execution and output following:
put c:\ftp.txt \In_test\ftp.txt
and
put c:/ftp.txt /In_Test/ftp.txt
Execute FTP Command
put c:\ftp.txt \In_Test\ftp.txt
NIECONN_BROKEN:TCP/IP Network Connection Broken in getreply()
TCP/IP error, connection terminated
and some time i got this error,
Execute FTP Command
put c:/ftp.txt /In_Test/ftp.txt
open c:/ftp.txt errno 22: Invalid argument
about your workstation firewall.
Firewall is Disable in client end and also server end.
Is it allowing the program SAPFTP to execute
when i put SAPFTP in run then i executed mean it display FTP prompt.
Did you check your SAPFTP RFC using RSFTP005?
SA38 --> RSFTP005
SAPFTP check
Check RFC destination SAPFTP..
... OK.
Ping RFC destination SAPFTP...
... OK.
Check RFC destination SAPFTPA.
... OK.
Ping RFC destination SAPFTPA..
... OK.
and also check from SM59 where connection test completed successfully.
regards, -
Calling Windows XP FTP Command in java
Hi there!
Need help in calling Windows XP FTP command in java:
executing the FTP command in DOS works well, but when I tried calling it in java using Process and Runtime objects, it successfully transferred the files from remote to my local pc... but I seemed to be stuck with .exec() and cannot continue with the other statements.
I know that I can use eFTPj or Apache Commons Net .. but I have no more time to study it since I have no more time left.
Any idea or suggestion? I badly need your help�
Take care and God bless,
MaDzSolution:
Better use Apache Commons Net - FTP for greater java support. -
ASP and FTP commands to use CHMOD or similar to change folder
permissions before uploading a file via a web form?
Is there a script or commands that can do this?
Are there any other settings that is avaiable on a domain
that can make sure that the user has access even though the folders
are set to "0755"?
This is all from a web form in a controlled area with
Username and Password.
I know that this is possible in PHP with two systems:
suPHP (installed by hosts with a rewrite_module or ftp_module
not really sure) or
FTP modules (I write a script with this "$conn =
ftp_connect("$host");,blah blah...")
Any ideas unless you have something already?
CheersI found this code, apparently it can reset but not change it
for my purposes.
'========================================================================================= ======
'RevokeRights
' denied specified users access to files specified by file
mask in folder specified by
' "Folder" parameter and its folders.
'Parameters:
' Folder - string. specify target folder
' Users - string array. Each string specified user or group
' FileMask - string. specified processing files: example
"C:\*.txt"
'========================================================================================= ======
function RevokeRights(Folder, Users, FileMask)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
RevokeFromFolder fso.GetFolder(Folder), Users, FileMask
end function
'========================================================================================= ======
'RevokeFromFolder
' Auxillairy function.denied specified users access to files
specified by file mask in ' folder specified by "Folder" parameter
and its folders.
'Parameters:
' Folder - "Folder" object. specify target folder
' Users - string array. Each string specified user or group
' FileMask - string. specified processing files: example
"C:\.htaccess"
'========================================================================================= ======
function RevokeFromFolder(byref Folder, Users, FileMask)
Dim Subfolders, sf1
Set Subfolders = Folder.SubFolders
Revoke Users, Folder.Path & "\" & FileMask
for each sf1 in Subfolders
RevokeFromFolder sf1, users, FileMask
Next
end function
'========================================================================================= ======
'Revoke
' denied specified users access to files specified by file
mask.
'Parameters:
' Users - string array. Each string specified user or group
' FileMask - string. specified processing files: example
"C:\*.txt"
'========================================================================================= ======
function Revoke( Users, FileMask)
Dim ws, cmd, i
Set ws = Createobject("WScript.Shell")
cmd = "%comspec% /c cacls " & FileMask & " /C /E /P
for i = 0 to UBound(Users)
cmd = cmd & Users(i) & ":n" & " "
Next
ws.Run cmd, 0
Set ws = Nothing
end function -
Put ftp commands inside Java code?
Hi.
I've no problems with ftp with exec(...), using an external ftp text file containing the ftp commands.
But can I pullthe ftp commands into the Java codes?
The reason is we don't want people accidentally messing around with the ftp commandsyou can also use URLs for FTPing:
* If the client needs to connect to the server through a proxy, this method sets the JVM FTP proxy settings.
* @param proxyHost Host name of proxy.
* @param proxyPort Port number of proxy host.
public void setProxy(String proxyHost, int proxyPort) {
if (proxyHost != null) {
System.getProperties().put("ftpProxySet", "true");
System.getProperties().put("ftpProxyHost", proxyHost);
System.getProperties().put("ftpProxyPort", ""+proxyPort);
}//setProxy()
* Upload a file to a FTP server. A FTP URL is generated with the following syntax:
* <code>ftp://user:password@host:port/urlpath;type=i</code>.
* @param ftpServer FTP server address.
* @param user Optional user name to login.
* @param pwd Optional password for <i>user</i>.
* @param fileName Destination file name on FTP server (with optional preceeding relative path, e.g. one/two/three.txt).
* @param source Source file to upload.
* @throws Exception on error.
public void upload(String ftpServer, String user, String pwd, String fileName, File source) throws MalformedURLException,
IOException {
if (ftpServer != null && fileName != null && source != null) {
StringBuffer sb = new StringBuffer("ftp://");
if (user != null && pwd != null) {
sb.append(user);
sb.append(':');
sb.append(pwd);
sb.append('@');
sb.append(ftpServer);
sb.append('/');
sb.append(fileName);
sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
URL url = new URL(sb.toString());
URLConnection urlc = url.openConnection();
bos = new BufferedOutputStream(urlc.getOutputStream());
bis = new BufferedInputStream(new FileInputStream(source.getName()));
int i;
while ((i = bis.read()) != -1) {
bos.write(i);
} finally {
if (bis != null) { try { bis.close(); } catch (IOException ioe) { /* ignore*/ } }
if (bos != null) { try { bos.close(); } catch (IOException ioe) { /* ignore*/ } }
}//upload()
* Download a file from a FTP server. A FTP URL is generated with the following syntax:
* <code>ftp://user:password@host:port/filePath;type=i</code>.
* @param ftpServer FTP server address (with optional port ':<port>').
* @param user Optional user name to login.
* @param pwd Optional password for <i>user</i>.
* @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
* @param destination Destination file to save.
* @throws Exception on error.
public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException,
IOException {
if (ftpServer != null && fileName != null && destination != null) {
StringBuffer sb = new StringBuffer("ftp://");
if (user != null && pwd != null) {
sb.append(user);
sb.append(':');
sb.append(pwd);
sb.append('@');
sb.append(ftpServer);
sb.append('/');
sb.append(fileName);
sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
URL url = new URL(sb.toString());
URLConnection urlc = url.openConnection();
bis = new BufferedInputStream(urlc.getInputStream());
bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
int i;
while ((i = bis.read()) != -1) {
bos.write(i);
} finally {
if (bis != null) { try { bis.close(); } catch (IOException ioe) { /* ignore*/ } }
if (bos != null) { try { bos.close(); } catch (IOException ioe) { /* ignore*/ } }
}//download() -
I am using FTP to save the a file from a local server to a remote server.
in the process, i form a connection and also execute command like ASCII, QUOTE PASV which all get successful.
but the main commands used to transfer or get file like GET, PUT are giving an error "INVALID COMMAND"
What could be any reason for this.Hi,
The below program is to create file on FTP server by taking the data from internal table
To see whether the file is created on the FTP server
use the function module FTP_SERVER_TO_R3.
Check the below code.
You write a same program with the function module FTP_SERVER_TO_R3 instead of
FTP_R3_TO_SERVER to check the existence of the file which is already created.
tables: t777a. "Building Addresses
Internal Table for Building table.
data: begin of it_t777a occurs 0,
build like t777a-build, "Building
stext like t777a-stext, "Object Name
cname like t777a-cname, "Address Supplement (c/o)
ort01 like t777a-ort01, "City
pstlz like t777a-pstlz, "Postal Code
regio like t777a-regio, "Region (State, Province, County)
end of it_t777a.
Internal Table for taking all fields of the above table in one line
separated by u2018|u2019(pipe).
data: begin of it_text occurs 0,
text(131),
end of it_text.
Constants: c_key type i value 26101957,
c_dest type rfcdes-rfcdest value 'SAPFTPA'.
data: g_dhdl type i, "Handle
g_dlen type i, "pass word length
g_dpwd(30). "For storing password
Selection Screen Starts
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
parameters: p_user(30) default 't777a' obligatory,
p_pwd(30) default 't777a' obligatory,
p_host(64) default 'XXX.XXX.XX.XXX' obligatory.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.
parameters: p_file like rlgrap-filename default 't777a_feed.txt'.
SELECTION-SCREEN END OF BLOCK blk2.
Password not visible.
at Selection-screen output.
loop at screen.
if screen-name = 'P_PWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
g_dpwd = p_pwd.
Start of selection
start-of-selection.
To fetch the data records from the table T777A.
select build stext cname ort01 pstlz regio
from t777a
into table it_t777a.
Sort the internal table by build.
if not it_t777a[] is initial.
sort it_t777a by build.
endif.
Concatenate all the fields of above internal table records in one line
separated by u2018|u2019(pipe).
loop at it_t777a.
concatenate it_t777a-build it_t777a-stext it_t777a-cname
it_t777a-ort01 it_t777a-pstlz it_t777a-regio
into it_text-text separated by '|'.
append it_text.
clear it_text.
endloop.
To get the length of the password.
g_dlen = strlen( g_dpwd ).
Below Function module is used to Encrypt the Password.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = g_dpwd "Actual password
SOURCELEN = g_dlen
KEY = c_key
IMPORTING
DESTINATION = g_dpwd. "Encyrpted Password
*Connects to the FTP Server as specified by user.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Connecting to FTP Server'.
Below function module is used to connect the FTP Server.
It Accepts only Encrypted Passwords.
This Function module will provide a handle to perform different
operations on the FTP Server via FTP Commands.
call function 'FTP_CONNECT'
EXPORTING
user = p_user
password = g_dpwd
host = p_host
rfc_destination = c_dest
IMPORTING
handle = g_dhdl
EXCEPTIONS
NOT_CONNECTED.
if sy-subrc ne 0.
format color col_negative.
write:/ 'Error in Connection'.
else.
write:/ 'FTP Connection is opened '.
endif.
**Transferring the data from internal table to FTP Server.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = g_dhdl
FNAME = p_file
CHARACTER_MODE = 'X'
TABLES
TEXT = it_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
write:/ 'File has created on FTP Server'.
ENDIF.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'File has created on FTP Server'.
To Disconnect the FTP Server.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = g_dhdl.
To Disconnect the Destination.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
others = 1.
Regards,
Kumar Bandanadham -
FTP Command Not in /usr/bin
My hard drive seems to have partially died, I can't seem to boot it up in to Target mode, but I can boot in to recover mode and then open up a terminal and navigate around the drive. I'm trying to FTP to my NAS so I can back up as much of my HD as possible, but I can't find the ftp command. I thought it was in /usr/bin but I only see sftp there and I can't sftp to my NAS (it's a WD MyBookLive).
I can ping my NAS, so I know it is there, I just don't know how to connect to it from terminal in recovery mode. Any other suggestion on how to connect to my NAS?Hi,
1. Type ftp to get into FTP mode - if this does not work, try accessing root by typing sudo -i and entering password for the machine. Then type ftp again. This should give you the command line ftp>
2. Type open <ip address>.
3. At this point you should be provided with a box where you type in your username and password for the NAS.
4. Type lcd<folder> or lcd <folder>.
5. Type ls and cd commands to place yourself into the desired folder on the NAS.
6. Type the ascii or bin command to set your file transfer to ASCII or Binary respectively.
7. Type one of the following commands to send or receive the desired files: get, mget, put and mput.
8. When finsihed, type the quit command to close the connection and exit to exit the FTP session. -
Since I'd moved to tiger, I'm not able to use my powerbook to update my web site. The command ftp bugs : impossible to list the content of some directory but it works fine on others. In fact it seems not to work on big directories, it's also impossible to put file file on that kind of directory...
I used to work fine with panther...
I tried third party programm but I got the same results... the server doesn't respond when I try to access some directory.
It works fine using the DOS ftp command on my PC. It's creasy.
Would should I do except from swithing to windows,... or installing panther again (but I don't know how to do that afer installing tiger without reformated my disk....)Hi,
Yes i found a solution, but it was not a nice one! My solution was to create an ABAP mapping. When the files comes to the XI i use this mapping and inside i have coded the FTP send procedure. For that i use the FTP_CONNECT and FTP_COMMAND function modules.
After the file has passed the mapping i just use af dummy Communication Channel to place the file on af arcive space.
/Jakob -
How do you return System Time of the local box in FTP command
How do you return System Time of the local box in FTP command... since I want to output the system time of my local box copying to the FTP server...
Its asking me to enter a new date... I actually want to return it into a log file since I am using ws_ftp.... but the log files dont have any date time being returned... i just want to be able to echo that date time into the log file... but it doesnt do that... I also tried
SHELL ECHO %DATE% %TIME%
but it returns this in the log file
Processing Line 10 [SHELL ECHO %DATE% %TIME]
I also tried in my ws_ftp script and it says:
Processing Line 15 [!Date]
Sending command [!Date] with parameter []
!Date
500 '!DATE': command not understood
Failure in command [!Date]
Maybe you are looking for
-
Why can't I create a custom size in a new document in CS4?
I just recently re-installed CS4 onto another computer and now I can't select "Custom" in the size when creating a new document.
-
if i was to get a ipad 3 would i be able to sync my iphone with it instead of using a computer ??
-
REUSE_ALV_LIST_DISPLAY give short dump beyond 100 columns
Hi, I have more than 170 columns in my internal table and this gives short dump when it reached 100the column because the structure RS_HEADER which displays column header can only hold 99 columns. Is there anyway I still use REUSE_ALV_LIST_DISPLAY a
-
Is there a free App to hide video & pics
Anyone know of a free app that will hide videos & pics on the PB, either app world or sideloaded?
-
I have recently upgraded my iPad 2 to iOS 7 and I have lost 3 app icons. The apps still appear in settings, so I can't reinstall the app as they're already there. I've tried uninstalling and reinstalling via an iTunes sync, but it hasn't helped. T