Sponsored Content
Top Forums Shell Programming and Scripting Use ftp command in shell script Post 302164552 by panknil on Tuesday 5th of February 2008 07:06:31 AM
Old 02-05-2008
MySQL

Try this

user='user1'
password='password1'
IP='***.***.***.***'

ftp -n -i -v $IP 22 <<-END_SCRIPT > LOG_file
user $user $password
status
bin
lcd <DESTINATION DIR>
cd <REMOTE DIR>
mget *.*
bye
END_SCRIPT

Regards,
Pankaj
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script for ftp

Hi ,, I am wrting a shell script to ftp a file from remote server but its giving some problem to me.can you help me in debugging this. #!/usr/bin/ksh HOST="some ip" user="user_name" passwd="password" ftp -n $HOST >>END_SCRIPT USER $user $passwd binary prompt get... (3 Replies)
Discussion started by: namishtiwari
3 Replies

2. Shell Programming and Scripting

ftp with shell script

Can I ftp to put file with shell script(as bath file) ? Plz give the simple code to do that. My script look like that #!/bin/sh echo "Start ftp" ftp temphost <<EOF put file quit EOF # end This code ignore username & password but I need to input. How to input username &... (8 Replies)
Discussion started by: aungomarin
8 Replies

3. Shell Programming and Scripting

Use ftp is a shell script

Hi, What i would like to do is to use a shell script connect to a remote computer and download files from a specific directory. I wrote the following script. #!/bin/sh HOST='IP' USER='yourid' PASSWD='yourpw' FILE='*.txt' REMOTEPATH=/incoming/MSC/ ftp $HOST <<END_SCRIPT user $USER... (3 Replies)
Discussion started by: chriss_58
3 Replies

4. Shell Programming and Scripting

problem in exit status of the command in a shell script-FTP

Hi All, I have developed below script for FTP a file from unix machine to another machine. ftpToABC () { USER='xyz' PASSWD='abc' echo "open xx.yy.zbx.aaa user $USER $PASSWD binary echo "put $1 abc.txt" >> /home/tmp/ftp.$$ echo "quit" >> /home/tmp/ftp.$$ ftp -ivn <... (3 Replies)
Discussion started by: RSC1985
3 Replies

5. UNIX for Dummies Questions & Answers

FTP shell script

Hi I am new in UNIX field. I don't know if I am posting in right forum or not. And I have also found out that there are so many posts about ftp shell scripting. I have tried those but actually having some problem. Well, my script should do the following..... It finds files( the filename ended... (3 Replies)
Discussion started by: abhishek_510
3 Replies

6. Shell Programming and Scripting

Help with Shell script for FTP

#!/usr/bin/ksh export filename=/grid/PowerCenter/inbound/AT/filelist.txt export SOURCE_DIR=/grid/PowerCenter/inbound/AT export ICOMS_FTP_TGT_DIR1=/dw/input/ATU/ICOM_SERV1 export ICOMS_FTP_TGT_DIR2=/dw/input/AT/ICOM_SERV2 export FILE_MASK="ATRPU_RP_ATU" echo "start" ftp_data_file() { ... (15 Replies)
Discussion started by: vsmeruga
15 Replies

7. Shell Programming and Scripting

FTP within a SHELL script

I am running the following on linux (on a mac): filename="/Users/thisfilename.txt" hostname="ftp.mysite.com" username="myusername" password="mypassword" echo '=======FTP========' ftp -un $hostname <<EOF quote USER $username quote PASS $password binary put $filename quit EOF I... (4 Replies)
Discussion started by: globalnerds
4 Replies

8. Shell Programming and Scripting

shell script for ftp files passed in command line argument

i want to write a shell script function that will ftp the files passed in the command line . i have written a shell script for ftp but how will it do for all files passed in command line argument , i am passing 4 files as argument ./ftp.sh file1 file2 file3 file4 code written by me... (5 Replies)
Discussion started by: rateeshkumar
5 Replies

9. Shell Programming and Scripting

FTP command issue in shell script

Hi All I am using following code in my shell script to send the file to a mainframe server. ftp -in $FTP_IP_SEND <<END_OF_FTP >$LOG_DIR/ProviderExportFTP.log quote user $FTP_USER_SEND quote pass $FTP_PASS_SEND ascii send ./ProviderExport.txt 'PROJ.PDRCACTS.FD87050.EXPORT' (REPLACE... (3 Replies)
Discussion started by: Renjith180282
3 Replies

10. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies
NETRC(5)						      BSD File Formats Manual							  NETRC(5)

NAME
netrc -- user configuration for ftp SYNOPSIS
~/.netrc DESCRIPTION
This file contains configuration and autologin information for the File Transfer Protocol client ftp(1). The .netrc file contains login and initialization information used by the auto-login process. It resides in the user's home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines: machine name Identify a remote machine name. The auto-login process searches the .netrc file for a machine token that matches the remote machine specified on the ftp command line or as an open command argument. Once a match is made, the subsequent .netrc tokens are processed, stopping when the end of file is reached or another machine or a default token is encountered. default This is the same as machine name except that default matches any name. There can be only one default token, and it must be after all machine tokens. This is normally used as: default login anonymous password user@site thereby giving the user automatic anonymous ftp login to machines not specified in .netrc. This can be overridden by using the -n flag to disable auto-login. login name Identify a user on the remote machine. If this token is present, the auto-login process will initiate a login using the specified name. password string Supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part of the login process. Note that if this token is present in the .netrc file for any user other than anonymous, ftp will abort the auto-login process if the .netrc is readable by anyone besides the user. account string Supply an additional account password. If this token is present, the auto-login process will supply the specified string if the remote server requires an additional account password, or the auto-login process will initiate an ACCT command if it does not. macdef name Define a macro. This token functions like the ftp macdef command functions. A macro is defined with the specified name; its con- tents begin with the next .netrc line and continue until a null line (consecutive new-line characters) is encountered. If a macro named init is defined, it is automatically executed as the last step in the auto-login process. SEE ALSO
ftp(1), ftpd(8) Linux NetKit (0.17) September 23, 1997 Linux NetKit (0.17)
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy