passing value through ftp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting passing value through ftp
# 1  
Old 12-16-2008
passing value through ftp

how to pass value through FTP.Below the script in k-shell

Code:
echo "Enter the month/day"
read value
ftp -v -n ddcappip031.tu.com << "EOF"
user amit jason
prompt
cd /ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles
mget CurrentCollectorMeterReadBackup2008'$value'.tar.gz
bye
EOF

below the error i m getting with the file name

[error]

CurrentCollectorMeterReadBackup2008$value.tar.gz: No such file or directory

[/error]
# 2  
Old 12-16-2008
Try
Code:
mget CurrentCollectorMeterReadBackup2008${value}.tar.gz

# 3  
Old 12-16-2008
i used the above suggested command ,but getting the error as

Code:
echo "Enter the month/day"
read value
ftp -v -n ddcappip031.tu.com << "EOF"
user amit jason
prompt
cd /ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles
mget CurrentCollectorMeterReadBackup2008${value}.tar.gz
bye
EOF


error:

Bad directory components
can't find list of remote files, oops
# 4  
Old 12-16-2008
Put set -x in your script and check if your path and file names are correct.
# 5  
Old 12-16-2008
yes evrting is fine,
when i m giving value manually in the script like 1020 it is pulling the file

mget CurrentCollectorMeterReadBackup20081020tar.gz

the path is correct and also files are there, the only problem is that when i entered the value the FTP is not taking that value and reading the file as

mget CurrentCollectorMeterReadBackup2008${value}.tar.gz

instead of

value=1020

mget CurrentCollectorMeterReadBackup20081020.tar.gz

Code:
#!/bin/ksh


echo "Enter the month/day"
read value

ftp -v -n ddcappip031.tu.com << "EOF"
user amit jason
prompt
cd /ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles
mget CurrentCollectorMeterReadBackup2008${value}.tar.gz
bye
EOF

Below the complete o/p i m getting now

Quote:
./FTPscript.sh
Enter the month/day
1020
Connected to ddcappip031.tu.com.
220 ddcappip031 FTP server (Version 4.2 Tue Nov 14 12:49:19 CST 2006) ready.
331 Password required for amit.
230-Last unsuccessful login: Mon Oct 20 09:21:27 2008 on ssh from 146.61.248.10
230-Last login: Tue Dec 16 02:00:03 2008 on ftp from mdcadedn05-pers.tu.com
230 User amit logged in.
Interactive mode off.
250 CWD command successful.
Bad directory components
can't find list of remote files, oops
221 Goodbye.

Last edited by ali560045; 12-16-2008 at 04:47 AM..
# 6  
Old 12-16-2008
Code:
root@isau02:/data/tmp/testfeld> VAR=cri; ftp -n isau02 << EOF
> user jupp something
> dir s${VAR}pt
> bye
> EOF
-rwx------   1 jupp     users           13 Aug 14 11:38 script

# 7  
Old 12-16-2008
still not getting is there anyother way to pass value in the script to FTP
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a string and passing passing arguments to a while loop

I have an for loop that reads the following file cat param.cfg val1:env1:opt1 val2:env2:opt2 val3:env3:opt3 val4:env4:opt4 . . The for loop extracts the each line of the file so that at any one point, the value of i is val1:env1:opt1 etc... I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies

2. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

3. Shell Programming and Scripting

FTP command line username and password passing

Dear All, I am new to unix and I am trying to build a shell script which will connect to a different server by passing username and password from a file or command line but not manually... In short I dont want to connect to a diff server via ftp interactively. Any suggestion...looking... (8 Replies)
Discussion started by: Pratik4891
8 Replies

4. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

5. Shell Programming and Scripting

passing parameter to ftp script from output of another ftp

Hi, I have a ftp script which first gets all the file names and echo's the latest file. I'm using another ftp command sets to get the file name given by first ftp. The problem is the parameter is not accepted by second ftp. The error message i'm getting is > Rename Temp File calloc:ICMP... (5 Replies)
Discussion started by: ammu
5 Replies

6. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Random parameters passing in FTP script

Hi I have a question. In the FTP script if we are passing all the required value like Hostname, username, password, Action(put or get), Filename, & mode(ascii or binary) through parameters then we have to pass these in the exact orders in which they are taken like if we defined Username=$2... (2 Replies)
Discussion started by: sourabhshakya
2 Replies

10. UNIX for Dummies Questions & Answers

passing ip address as a variable to script for ftp

Still a Beginner here .. Does anyone no how to get the IP address of the machine thats logged in (bearing in mind there will be others logged in) while they are logged in to the Unix server and pass this as a variable to a shell script so as I can FTP files to that machine via a shell script, at... (2 Replies)
Discussion started by: Gerry405
2 Replies
Login or Register to Ask a Question