Deleting File from FTP and Transferring File to FTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Deleting File from FTP and Transferring File to FTP
# 1  
Old 05-20-2009
MySQL Deleting File from FTP and Transferring File to FTP

Hi,

I am getting error when i am deleting file from FTP and also transferring file from local to FTP server.

I am getting 221 error. I am getting this error some time only.

Some time the existing file from FTP is deleted and file from local directory is transferred to FTP server.

Some time the existing file from FTP is deleted and file from local directory is not transferred to FTP server.

My code is like below

ftp -n -v <FTP Server> <<INPUT_END> LOGFILE.txt
quote user <user name>
quote pwd <password>
cd <FTP Path>
mdelete INS_7131*.IN
mput <FILE Name>
INPUT_END

Is there any syntax error in above code.

This is urgent. Pls tell me why sometime the file is transferred to FTP and sometime not transferred to FTP server.

Pls give me the solution as early as possible.
# 2  
Old 05-21-2009
221 Service closing control connection.
Logged out if appropriate.


ftp returns series codes - numbers like 500 or 221. These codes tell you what happened to a particular request. 221 can mean things like 'the connection was lost' for example.
You have to ask yourself - why would the remote server close the connection?
Or why would it look like that from my end? If you need an absolutely detailed account, you would have to be able to monitor what was going on at the remote host just when it returned 221.

The simple answer is to retry the operation. If it fails three times, send an email to the sysadmin or whoever is appropriate. This means you have to check codes in the script. For a complete list of these codes go to RFC 959
http://www.faqs.org/rfcs/rfc959.html
# 3  
Old 05-21-2009
Assuming normal FTP, the script as posted contains errors.
1) No space character after the first INPUT_END
2) FTP login line incorrect.

Maybe try it with a ftp "dir" command first to ensure that you can connect.

Code:
ftp -n -v <FTP Server> <<INPUT_END >LOGFILE.txt
user <user name> <password>
cd <FTP Path>
dir
INPUT_END

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting local server file from automated FTP script

Hi, I want to delete a file on the local server, while connected to remote server through FTP. I am using the below code for this $FTP_CMD -v -n $HOST <<*! >> $LOGFILE 2>&1 user $USER $PASSWORD cd $DIR ... (11 Replies)
Discussion started by: jhilmil
11 Replies

2. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

3. UNIX for Advanced & Expert Users

why file automatically deleting in ftp server

Iam putting file in ftp server. iam doing ftp to transfer a file to ftp server but after sometime(10 sec) the file is automatically deleting in the ftp. Can i know why this happens. When my friend ftp the file to the same server , the file is not deleting aftersometime... it is there. Can... (1 Reply)
Discussion started by: nani1984
1 Replies

4. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

5. Shell Programming and Scripting

how to put file from one ftp to another ftp location

hi, I have one file located in ftp.I want to place that file in different ftp location. Up to now i am doing it manually using get command and copying that file in to my local system and then putting that file in different ftp using put command. now i want to automate that using shell... (1 Reply)
Discussion started by: prasee
1 Replies

6. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies

7. Shell Programming and Scripting

FTP - To handle error while transferring files

Hi, I had written an FTP script where in I loop through the directories and transfer the files from each and every directory of Windows to UNIX. Now the problem is when 1. The connection is unable to be established I should return some error codes 2. When there is some system... (1 Reply)
Discussion started by: mahalakshmi
1 Replies

8. Shell Programming and Scripting

transferring files using ftp but mantaining the dates

Hi guys, Is there a way I can ftp some files without changing the last-modified dates from them ? I haven't seen any ftp option to do so. Or, alternatively, how do I change the last-modified date for a file, if this is possible... ? Thanks in advance, Abrahao. (4 Replies)
Discussion started by: 435 Gavea
4 Replies

9. Shell Programming and Scripting

FTP session expiring when transferring files... Need some solution

Hi All, I am running a ftp script which is running fine even with crontab. But the problem is that when I connect to ftp server and transfer files , i observe that ftp session expires after few minutes and the file transfer is not completed as there are alot of files to be transfered . ... (4 Replies)
Discussion started by: aarora_98
4 Replies

10. IP Networking

Transferring data to a windows environment using ftp

I need to transfer data from SCO Unix to a windows 2000 or 98 machine. The files are too big for doscp, and I can't get the right programs for transferring via kermit. So the next step, though perhaps more difficult, would be to set up an ethernet network and tranfer the data using ftp. I have... (3 Replies)
Discussion started by: ccs8217
3 Replies
Login or Register to Ask a Question