FTP in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP in UNIX
# 1  
Old 07-25-2012
FTP in UNIX

I am using the FTP script in UNIX, Is it possible that when the FTP connection maintained in the remote computer
It should check the file on the remote computer if file is present then it should ftp ed that particular file, and if not present
then it should do nothing.

The working code which i made is below,

Code:
HOST='xxxx'
USER='xxxxx'
PASSWD='xxxxxx'
ftp -i -n $HOST << START
user ${USER} ${PASSWD}
binary
cd /home/xxxx/xxxx
get test
quit
START

Thanks
# 2  
Old 07-25-2012
Code:
# $1 == filename
HOST='xxxx'
USER='xxxxx'
PASSWD='xxxxxx'
# find out if the file is on the remote box
ftp -i -n $HOST << START > /tmp/chk
user ${USER} ${PASSWD}
binary
cd /home/xxxx/xxxx
dir ${1}
quit
START
# this looks to see if remote file was found  otherwise exit early
[ grep -fq 'test' /tmp/chk ]  || exit
ftp -i -n $HOST << START
user ${USER} ${PASSWD}
binary
cd /home/xxxx/xxxx
get ${1}
quit
START

This does what you ask but is not efficient.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with FTP in UNIX

Hi All, I am a beginner in Unix, wanted to know can we FTP one file located in one server to the another server location using Putty. The destination would require user ID and password to access the location. Also, the file that needs to be picked up should have the date of previous day. ... (1 Reply)
Discussion started by: richa shukla
1 Replies

2. Shell Programming and Scripting

FTP from windows to unix server using unix shell script

Hi, Is it possible to ftp a huge zip file from windows to unix server using unix shell scripting? If so what command i need to use. thanks in advance. (1 Reply)
Discussion started by: Shri123
1 Replies

3. Shell Programming and Scripting

UNIX script to FTP file from UNIX server to windows

Hi, I am new to this subject.....Can someone please help me out with the script... unix usernm "sdhftst" unix pwd "chsd13" windows usernm "dfghtst" windows pwd "chsd13" path..../xxx/xxxxx/xxxxxx/xxxxxxx please can u get me a script...its only one file to get ftp. Thanks... (2 Replies)
Discussion started by: himakiran9
2 Replies

4. Shell Programming and Scripting

ftp from windows to unix using a perl script on unix machine

i need to ftp a file from windows to a unix machine by executing a sript(perl/shell/php) from that unix machine.i can also use HTML and javascript to build forms. (3 Replies)
Discussion started by: raksha.s
3 Replies

5. UNIX for Advanced & Expert Users

MVS->Unix FTP : Using chmod as part of FTP.

We are transferring file from mainframes to unix, & in FTP process itself we would like to set access rights for unix machine. Has anyone used chmod command in association with site command in ftp? How it should be used? Thanks in advance. (1 Reply)
Discussion started by: videsh77
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. UNIX for Dummies Questions & Answers

Pc to unix ftp

Hello guys..I am new to Unix, I am trying to transfer a .txt file from my windows PC to my Unix account at school using ftp. I am kind of stuck, can anybody explain to me the steps to do this? (1 Reply)
Discussion started by: Aristo
1 Replies

8. Shell Programming and Scripting

FTP script for sending a file from one unix directory to another unix server director

Hi, My local server is :/usr/abcd/ Remote server is :/Usr/host/test/ I want to send files from local unix directory(All files starting with O_999) to remote host unix directory. Can any body give me the Unix Shell script to do this. One more doubt: Shall we need to change the file... (1 Reply)
Discussion started by: raja_1234
1 Replies

9. UNIX for Advanced & Expert Users

ftp from NT to UNIX

PROBLEM !!!!!!! I have files that is on a NT machine. It is located in a directory with subdirectories underneath it. TAR can not be used. I need to use a normal ftp command script to transfer these files from NT to UNIX, or get it from the UNIX machine, including the subdirectories. It must... (5 Replies)
Discussion started by: wolf
5 Replies

10. UNIX for Advanced & Expert Users

ftp from unix to pc

Hi All, How can I get a file as soon as generated into the unix server, it should get transferred into my pc? my pc connected to novell, and I know the ip address of my pc and unix server. reply to : ::email removed:: regards krishna (2 Replies)
Discussion started by: krishna
2 Replies
Login or Register to Ask a Question