Batch files and FTP under Unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Batch files and FTP under Unix
# 1  
Old 07-16-2001
Batch files and FTP under Unix

Hey all,

Does anyone know if Unix has an equivalent to a batch file? And if so, does it work the same way as a batch file under windows?

AND, if you can answer that one, is it possible to run such a file under HP-UX and have it execute while in an FTP command line? What I need to do is backup some data onto an NT server from the HP-UX setup in a routine matter and I was wondering if I could nearly automate the process. Any help would be appreciated.

ober5861
# 2  
Old 07-16-2001
Hi, ober

You can write a simple shell script to automate an ftp process, similar to a win batch file. Check out Heiner's Shelldorado at http://oase-shareware.org/shell/ for scripting resources. The ftp man page on your system will help, too.

To schedule the ftp process, you can make an entry in your crontab. (man cron or man crontab).
# 3  
Old 07-16-2001
Computer

Thanks a bunch! I'm not the best at writing shell scripts at this point, but I guess there's no better time to start, right?
# 4  
Old 07-16-2001
Tools

if you want ftp to be done automatically, here is a file called ".netrc" (see man page .netrc)

However, there is a security risk to run this one since password(s) will be on this file;
make sure to delete this file after runing your cron job(s) or shell script(s).
Hope this help
Smilie
# 5  
Old 07-16-2001
Lightbulb

This is a typical "batch" ftp script we run all the time:

#!/usr/bin/ksh

## put server name or IP address of FTP server
## provide username & password for the ftp server
## cd to whatever directory you want to put files to or get files from
## issue get or put commands -
## Anything you can do on a command line can be inside this script
ftp -n -v ipaddress <<-ENDTAG
user username password
cd dir
get file1
prompt
mget filepattern*
ENDTAG

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

FTP batch file suddenly stopped working

Hello, we have a UNIX system the runs our business data. We have 4 users that use a particular batch command file to extract data for use in the Windows side of the fence: (despreg.bat) ftp ftp> open danapak (database name) connected to danapak ftp> user ccsb password ccsb ftp>... (29 Replies)
Discussion started by: Mick_Dundee
29 Replies

2. Shell Programming and Scripting

How to execute a batch file containing ftp commands??

hi, is there a way i can execute a batch file containing ftp commands like we execute sftp batch file. sftp -b batchfile user@server > output how to create a batch file for ftp executing command and how to run the batch file from a shell script? (2 Replies)
Discussion started by: Little
2 Replies

3. Shell Programming and Scripting

FTP in batch mode

HI, Need to ftp a bunch of files in a directory in batch mode. TRying to ftp a single file first with below code. #!/bin/ksh function ftp_files { ftp -n ${D2_SRVR} <<-EOF quote user ${D2_UID} quote pass ${D2_PWD} cd ${D2_DIR}/${D2_NAME} lcd ${D1_DIR}/${D1_NAME}/dml/ put file1 ... (6 Replies)
Discussion started by: cvsanthosh
6 Replies

4. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

5. UNIX for Dummies Questions & Answers

Performing Batch ftp without .netrc

How can I supply the userID/password when executing FTP in the batch mode? Using .netrc is not an option (prohibited per Corporate Policy). Thank you in advance. (1 Reply)
Discussion started by: compaamat
1 Replies

6. UNIX for Advanced & Expert Users

Use of GDG files in UNIX using MBM (Mainframe Batch Manager).

Use of GDG files in UNIX using MBM (Mainframe Batch Manager). Is any one working with GDG files in UNIX (AIX) using the MBM wrapper? I need some help to refer the GDG files in the scripts. (0 Replies)
Discussion started by: deeceeds
0 Replies

7. Windows & DOS: Issues & Discussions

Batch file to Get New Files Only through FTP

Hi there I want to create a batch file which Get (mget) the newly added Files only from specific directory on UNIX server to specific folder on windows server using FTP, and this batch file will be scheduled on the windows server to run daily to load the new files (load the newly added files... (1 Reply)
Discussion started by: alsharq
1 Replies

8. Windows & DOS: Issues & Discussions

Batch file to Get New Files Only through FTP

Hi there I want to create a batch file which Get (mget) the newly added Files only, from specific directory on UNIX server to local folder on windows server through FTP, and this batch file will be scheduled to run daily to load the new files. help me plz :confused: (1 Reply)
Discussion started by: alsharq
1 Replies

9. UNIX for Dummies Questions & Answers

Unix Batch FTP - SAS

Hi All, Im trying to write a Unix FTP batch file within a program called SAS. Now i already have one for windows which works fine, but it doesnt work within unix. I've been told that some of the commands are different from Windows to Unix, and ive looked round and am completely stumped... ... (0 Replies)
Discussion started by: shenniko
0 Replies

10. UNIX for Dummies Questions & Answers

UNIX Batch FTP Command file

Hello, I am a UNIX newbie and this is my first posting. I need to create a batch command file to ftp from Sun/Solaris to AS/400. Here is an example file: ftp -d -i -n -v 172.28.16.22 pwd ls binary quit This is the result of executing the command file: Connected to... (10 Replies)
Discussion started by: pietro
10 Replies
Login or Register to Ask a Question