The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script for FTPing files to mainframe GDG dsrookie UNIX for Dummies Questions & Answers 1 03-13-2008 06:32 AM
FTPing from XP to Solaris dtferreira UNIX for Dummies Questions & Answers 3 07-12-2007 01:42 PM
FTPing from unix box to windows box. aarora_98 Shell Programming and Scripting 8 01-25-2007 06:40 AM
Error in ftping script Chanakya.m Shell Programming and Scripting 5 12-19-2006 01:48 PM
FTPing over COM port ??? badge UNIX for Advanced & Expert Users 1 04-15-2004 05:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-29-2006
Registered User
 

Join Date: Nov 2006
Posts: 23
Ftping through unix script

Hi all,

I am trying to write a script to connect to remote host and ftp some files there.
The problem i am facing is,I dont know how to specify username and password for remote host through scripting.
and even if i am able to connect to remote host,then how should i execute
commands like mput etc through unix scripting.

Please do suggest me, how to write the code for the same.

Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 11-29-2006
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,644
Post Here to Contact Site Administrators and Moderators is not an appropriate forum to post this question in, please post in an appropriate technical forum.

Thread moved.
Reply With Quote
  #3  
Old 11-30-2006
Registered User
 

Join Date: Sep 2003
Location: mumbai
Posts: 20
#Try the following script

###############################
HOST='10.174.47.132'
USER='dbg\\azaveri-a'
PASSWD='Pass@word2'
cd /usr/Fax

a=`echo $p\_1\.txt`
b=`echo $q\_1\.txt`
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd post
bi
lcd /usr/Fax/
prompt off

put $a $b
quit
END_SCRIPT
exit 0
#####################################
Reply With Quote
  #4  
Old 11-30-2006
Registered User
 

Join Date: Nov 2006
Posts: 23
Thanks Girish!!
I am able to connect to remote host and also able to ftp the files there.
The problem that now i am facing is i want to take the count of files ftped.

I have taken the count on local host, say in var1 before ftping.
Now i want to take the count on remote host ,say in var2 and want to compare both of them to ensure successful ftp of all the files.

Still i am not able to determine the scope of these variables and also how to get value in var2.

Looking forward for help,
Thanks!
Reply With Quote
  #5  
Old 11-30-2006
Tornado's Avatar
Registered User
 

Join Date: Nov 2006
Location: Melbourne
Posts: 244
This might help you.
http://www.unix.com/showpost.php?p=3...4&postcount=27

I still have a few things to add, but it does work in its current form.
You just need to make sure you have the .sent and .receiving directories on both servers.
Reply With Quote
  #6  
Old 11-30-2006
Registered User
 

Join Date: Oct 2004
Posts: 235
Hi ...


Please try the below script ..

#!/bin/sh
cd /home/user
ftp -n 111.222.333.444 <<EOT
quote user unixuser
quote pass unixuserpass
binary
cd /TEST
put test.txt
quit
EOT



As far unix is concerned you can do ftp to a windows machines ...In the above script if you find any prob please come up with ...

Thanks,
Arun...
Reply With Quote
  #7  
Old 12-01-2006
Registered User
 

Join Date: Nov 2006
Posts: 15
FTP script

This might help

ftp -nv $HOST <<EOF1
user $FTP_ID $FTP_USR_PASSWD

lcd $target_dir

cd $source_int_dir
$TRANSFER_METHOD
get $file_name

quit



EOF1


here store your user id ,password and file name in variables which you will ftping to the remote server denoted by $HOST
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:41 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0