LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-06-2008, 01:07 AM   #1
kdyzsa
LQ Newbie
 
Registered: May 2008
Posts: 7

Rep: Reputation: 0
FTP Problem


Hi, I'm currently stuck in this ftp problem. Normally I just type ftp at the command line, but now I have to implement it in a code.

Basically I have to transfer a .txt file from a server, let's say hkhpdv13 in the folder of /home/sap/ftp to another server hkhpdv15 in the folder /home/sap/ftp/text. Both of these servers has a different user name and password

I've researched and saw this sample code.

#!/bin/sh
HOST='ftp.users.qwest.net'
USER='yourid'
PASSWD='yourpw'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0

I don't really know where they get the END_SCRIPT, and also how they transferred to another server there. Help in explaining please?

I want to know how to transfer a file if it switches from one server to another. As well as how do I know if the file transfer was successful or not, is there a code in there? or something any help would be appreciated.

Last edited by kdyzsa; 06-06-2008 at 01:48 AM.
 
Old 06-06-2008, 04:51 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
The END_SCRIPT is marking the end of the ftp session that begins with the line
Code:
ftp -n $HOST <<END_SCRIPT
The HOST variable is the remote host. The script presumes that you will be in directory containing FILE on the local machine when you execute the script.

You may want to check out C-Kermit if you will be doing scripted ftp transfers.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp from LInux to Serv-U ftp server problem csross Linux - General 2 11-07-2005 04:35 PM
FTP problem DataCorrupt Linux - Newbie 1 08-04-2005 11:06 AM
problem with ftp on mandrake 10.1 Official, ftp speeds system wide (anybody noticed?) equinox Mandriva 15 11-10-2004 02:07 PM
ftp problem freakydude Linux - Networking 3 09-01-2003 01:36 PM
ftp problem! anoop_chandran Linux - Networking 1 12-11-2001 09:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration