Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am simply not a programming guy. I deal with networks. I need a script to copy files from a remote server(Linux) to another machine.I have only ftp access to the remote server. Files are generated daily but fetched twice a week. Can anyone help me out in this ????

share|improve this question

closed as not a real question by Sven, Zoredache, voretaq7 Jan 22 '13 at 23:42

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Where are you getting stuck? It us unlikely that you will be able to get someone to compose a script for you. But if you need help with a specific detail, then you should ask about that. You really haven't given anyone enough information to help you in a useful way. –  Zoredache Jan 22 '13 at 23:25

1 Answer 1

You can use the ftp command in a bash script.
Since you don't provide much details, I'll just give you a link to a simple HowTo on using the ftp command in a bash script.

An example working script which fetches the file saved in the $FILE variable is this one:

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

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

Note that you'll land in the folder that is set as ftphome for the user which you use to login to the remote server. If you have to change the directory, you can use cd dirname before get $FILE.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.