script for ftp commands

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for ftp commands
# 1  
Old 02-27-2002
Data script for ftp commands

I need to setup a script to ftp a file from one unix box to another. I have modified the.netrc file, thus I can ftp into another box without being prompted for password. The question I have is, how can I setup a script which would after ftp, will change a directory, issue the bin command, then issue the put command and then quit the ftp. Could anyone help?????
# 2  
Old 02-27-2002
Tools Answer

Following is the script code that I got from a friend and it worked like a charm:

/usr/bin/ftp ftpsiteaddress <<EOI
verbose on
cd <directoryname>
put <filename>

# 3  
Old 02-27-2002
You might also need to include a user name and password also.

/usr/bin/ftp ftpsiteaddress <<END
verbose on
user username password
cd <directoryname>
put <filename>
mput <filename>
get <filename>
mget <filename>

Also when you copy the above, ensure that there are no white-spaces after the END, otherwise you'll have errors.
# 4  
Old 02-28-2002
MySQL Thanks

Thanks for your help.
# 5  
Old 03-11-2002
using the username and password in your script file will send them as clear text if security is an issue better to use them in .netrc for security issues Smilie
# 6  
Old 03-11-2002
Agreed, however if the ftp is within the same subnet, or does not go outside the primpary firewall ( or DMZ ), you should not really have any troubles.

Hope I got that right, still learning the networking side of things.
# 7  
Old 09-05-2002


T H A N K S !!!

Your script is magic !!! :-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Open Source

Shell script file movement to a Mail Box server using ftp commands

Hi All, I have a current Process that runs "windows script " for the file movement that needs to changed to a "DataStage Process (Using shell script )" Source :Text file is getting generated as part of Datastage Jobs processes and resides in a shared drive (Unix server) Target :ftp... (2 Replies)
Discussion started by: developer.dwh9
2 Replies

2. Shell Programming and Scripting

Script to retry FTP commands if unsuccessful and capture the failure status code.

I am using the below code to ftp file onto another server FTP_LOG_FILE=${CURR_PRG_NAME}- ${FTP_FILE}-`date +%Y%m%d%H%M%S`.log ftp -ivn ${FTP_HOST} ${FTP_PORT} << ENDFTP >> ${EDI_LOG_DIR}/${FTP_LOG_FILE} 2>&1 user ${FTP_USER} ${FTP_PSWD} lcd... (2 Replies)
Discussion started by: akashdeepak
2 Replies

3. UNIX for Dummies Questions & Answers

Ftp login commands

Hello, I am using ftp on command line. The problem is getting bumped off after 15 minutes of no activity.. I have two options: quit ftp and use the command history of my shell, or stay in ftp and use 'open' command, where I can use the command history saved in the ftp program. Either option... (1 Reply)
Discussion started by: Allasso
1 Replies

4. Shell Programming and Scripting

Commands not executing after FTP in shell script

Hello In the shell script we have a FTP command like below ftp -n -v -q >/infa/datafiles/GRP/Scripts/ftp_from_infa_dvcn.log<<END_SCRIPT   quote USER $FTP_USER quote PASS $FTP_PASS ascii lcd $FTP_LOCALDIR cd $FTP_FLDR put $FTP_FILE   bye exit If i... (1 Reply)
Discussion started by: Pratik4891
1 Replies

5. UNIX for Dummies Questions & Answers

Parsing linux commands through FTP

Hi Techies, I have made a shell script which stores the output of it in a text file. then i wanted to fetch that text file using windows scheduler in my windows xp desktop which i did successfully using the below mentioned ftp .bat file : @echo off @echo ftp_user>ftp_test.scr @echo... (0 Replies)
Discussion started by: gemnian.g
0 Replies

6. Shell Programming and Scripting

How to use ftp commands inside shell script? Help please

Dears, I'm new in shell scripting and i need your help, i would like to know how can i create a script to ftp to a certain unix/linux machine/server IP address and get a file for example without user intervention? How can i force the script to use a certain username and password to access this... (4 Replies)
Discussion started by: Dendany83
4 Replies

7. HP-UX

not able to upload the pjl commands thru ftp

Hi , By status requests to the printer using the PJL commands like status_read_back there is no answer. The printer itself is functioning well and is printing all requests. Ping, lpstat -t, nslookup is functioning well. The printer model is HP LJ 4200. The printer has been configured as network... (1 Reply)
Discussion started by: amit kul
1 Replies

8. IP Networking

ftp dir and pwd commands

Hi, I have a conenction to remote server that I'm sending files too via FTP. The problem I have is that when the file gets delivered it is 0 (zero) size. I've manually connected and logged on. The only command I can successfully execute is pwd. When I do a dir or a put command it will... (7 Replies)
Discussion started by: nhatch
7 Replies

9. UNIX for Advanced & Expert Users

FTP commands in SFTP

Hi, I am in the process of migrating all my FTP data flows into SFTP to make data more secure... I have used many quote site commands in our FTP sesssion. In SFTP i found that there is no option to do such commands. Does any body here know to overcome the current situation. Regards,... (2 Replies)
Discussion started by: Astra
2 Replies

10. UNIX for Dummies Questions & Answers

FTP - Executing Commands

I have written a script to ftp a file from Unix to an NT machine to authenticate ftp login I have added the information into the .netrc file when logged in using ftp the commands are not executed. Does anybody know how to make the command execute once username and password have been provided using... (2 Replies)
Discussion started by: hesmas
2 Replies
Login or Register to Ask a Question