FTP Scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP Scripts
# 15  
Old 11-30-2007
Quote:
Originally Posted by vgersh99
you can close your eyes..... Smilie
Code:
#!/bin/ksh

oldmodes=$(stty -g)
stty -echo
read password
stty ${oldmodes}

It worked fine ..

But is there a way to read from a file about the directories

for an example , the directories are not going to be constant and i am trying to get a file from a server by reading the param file a.txt

and placing it in a directory in the target which should also be read from a file

i am struggling a bit here

can anyone help me on this

Thanks
# 16  
Old 11-30-2007
here's an idea to expand upon - it probably does not answer your specific question, but should make you think how to adopt it to what you need.

Quote:
# I need to read a set of filenames from another file ('listOfFiles')
# and ftp 'get' them from a remote system. What is the way to get
# it by using ftp command once and send them all in a loop
# instead of using ftp command in the loop?
# Assumption: the 'listOfFiles' file containts a list of files to be
# ftp-ed - one file name per line.
Code:
#!/bin/ksh

ftp -nv <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
cd $ifile
lcd "$ofile"
$(sed -e 's/^/get /g' ${listOfFiles})
bye
EOF


Last edited by vgersh99; 11-30-2007 at 04:27 PM..
# 17  
Old 11-30-2007
Quote:
Originally Posted by vgersh99
here's an idea to expand upon - it probably does not answer your specific question, but should make you think how to adopt it to what you need.


Code:
#!/bin/ksh

ftp -nv <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
cd $ifile
lcd "$ofile"
$(sed -e 's/^/get /g' ${listOfFiles})
bye
EOF

not sure of this function , so you mean to say that , the list of files i need ti define it in a variable , ?

before the ftp session starts
# 18  
Old 11-30-2007
yes. the value of variable 'listOfFiles' is the pathname to the file containing the 'file names' that you need to operate on (one per line).
# 19  
Old 11-30-2007
Just Checking whether will it work , if i give the directory there in list of files
mean to say only the directory name and getting all the files in the directory
to the remote server?

Thanks
# 20  
Old 11-30-2007
Quote:
Originally Posted by raghav1982
Just Checking whether will it work , if i give the directory there in list of files
mean to say only the directory name and getting all the files in the directory
to the remote server?

Thanks
well.... your initial explanation was not clear and I had to throw just an idea.
what exactly do you want to specify?
  1. a list of files to be transfered?
  2. a list of directories - and get/put ALL the files from 'listed' directories?
  3. maybe a combination of the above????
What I've posted covers '1.'
# 21  
Old 11-30-2007
Bug

combination of 1 & 3

I am asking the User to enter the Source Server

he enters the source userid& Password

Loggin to the source server and getting some files

This is my basic scenario

but i have a requirement that my filename and directory paths are not Static , so i need to define the directory to login to the source server and need to define the filenames and also need to define where i need to place the file (get) to the target server

Please let me know if this is a bit confusing

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[HELP] Scripts moving aging file by FTP

Hi Experts, Kindly share scripts to find aging file and ftp to another server.. Example: Find files more than 5 days and ftp to another server. Please give suggestion :) Thanks Edy (1 Reply)
Discussion started by: edydsuranta
1 Replies

2. HP-UX

Scripts to move files via FTP with error checking

Hi Members, Can members please advise or suggest how to write UNIX script which move all zip files in source directory and when done delete zip files from source directory? We want to delete only on successful transfer to the destination. secondly want to add some error checking if the FTP... (1 Reply)
Discussion started by: dxj0815
1 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Problem with ftp scripts and cron

Need some help / advice with the follow script... Basically i have an FTP server that connects to other ftp servers and sends and downloads files every few hours or so. There are 12 different accounts that all have 2 scripts each, one to send and one to receive. Below is an example send script... (1 Reply)
Discussion started by: mokachoka
1 Replies

5. Shell Programming and Scripting

Need help with FTP scripts

Hi, I'm using the following code to FTP files from a remote system. ftp -inv <ip address> <<ENDFTP user uname password ENDFTP echo " binary get <file name> bye " > ftp.tmp ftp -inv < ftp.tmp I want to know how I can capture the details of the FTP process in a file. I would also... (3 Replies)
Discussion started by: bornon2303
3 Replies

6. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

7. Shell Programming and Scripting

FTP is using shell scripts create ? for file

ftp -n -v <<EOF verbose open 3.57.40.79 user infodvlp pr0gram ascii lcd /home/a501420038/GLA/Success_Load/ cd /ftp/SrcFiles/csg/InstruAsia/ get AU_Success_Log.txt close quit EOF Please help on this, this gives the out put "AU_Success_Log.txt?" As question mark in the last what will... (1 Reply)
Discussion started by: a501420038
1 Replies

8. Shell Programming and Scripting

How to find out Errors in FTP Scripts

Hi Please let me know is there any way through which I can find out errors & do debugging in FTP scripts. Thanks Sourabh TCS (1 Reply)
Discussion started by: sourabhshakya
1 Replies

9. Shell Programming and Scripting

FTP Shell Scripts from Windows to Unix: files have exotic characters

Hey guys, I am working on my shell scripts in wordpad in windows. Then, I upload it to my unix using psftp, but when I open those files with "vi" in Unix, there are all these "^M" characters in the file. Would anyone of you have a clue as to why? Help would be appreciated. Thanks, Laud (4 Replies)
Discussion started by: Laud12345
4 Replies

10. UNIX for Advanced & Expert Users

Multiple FTP scripts submitted to a subprocess

Why does running 5 FTP scripts sequentially take longer to run (16 seconds) than when all 5 are submitted to a subprocess and run simultaneously (7 seconds)? I would think there would be some I/O contention. There are about 10 files to be FTP'd in each script. Although each script... (0 Replies)
Discussion started by: tomstone_98
0 Replies
Login or Register to Ask a Question