passing value through ftp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting passing value through ftp
# 8  
Old 12-16-2008
Can you change your script like following:

from
Code:
mget CurrentCollectorMeterReadBackup2008${value}.tar.gz

to
Code:
dir CurrentCollectorMeterReadBackup2008????.tar.gz

... and post the output here.
# 9  
Old 12-16-2008
using dir i m able to get the file name but how to copy it using FTP

Code:
#!/bin/ksh
set -x

cd /ednadtu3/u01/pipe/naveed/class
echo "Enter the month/day"
read value

ftp -n ddcappip031.tu.com << "EOF"
user amit jason
prompt
cd /ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles
dir CurrentCollectorMeterReadBackup2008????.tar.gz
bye
EOF

output
---------------------------------

+ cd /ednadtu3/u01/pipe/naveed/class
+ echo Enter the month/day
Enter the month/day
+ read value
1020
+ ftp -n ddcappip031.tu.com
+ 0< /tmp/sh3616862.2
Interactive mode off.

-rw-r----- 1 pipe pipe 79895161 Nov 19 23:05 CurrentCollectorMeterReadBackup20081119.tar.gz
-rw-r----- 1 pipe pipe 70604904 Nov 20 23:04 CurrentCollectorMeterReadBackup20081120.tar.gz
-rw-r----- 1 pipe pipe 70907652 Nov 21 23:05 CurrentCollectorMeterReadBackup20081121.tar.gz
-rw-r----- 1 pipe pipe 72986381 Nov 22 23:05 CurrentCollectorMeterReadBackup20081122.tar.gz
-rw-r----- 1 pipe pipe 68609570 Nov 23 23:04 CurrentCollectorMeterReadBackup20081123.tar.gz
-rw-r----- 1 pipe pipe 69937900 Nov 24 23:05 CurrentCollectorMeterReadBackup20081124.tar.gz
-rw-r----- 1 pipe pipe 70518963 Nov 25 23:05 CurrentCollectorMeterReadBackup20081125.tar.gz
-rw-r----- 1 pipe pipe 69788932 Nov 26 23:05 CurrentCollectorMeterReadBackup20081126.tar.gz
-rw-r----- 1 pipe pipe 70712364 Nov 27 23:04 CurrentCollectorMeterReadBackup20081127.tar.gz
-rw-r----- 1 pipe pipe 69530103 Nov 28 23:04 CurrentCollectorMeterReadBackup20081128.tar.gz
-rw-r----- 1 pipe pipe 69359582 Nov 29 23:04 CurrentCollectorMeterReadBackup20081129.tar.gz
-rw-r----- 1 pipe pipe 70377462 Nov 30 23:04 CurrentCollectorMeterReadBackup20081130.tar.gz
-rw-r----- 1 pipe pipe 71530553 Dec 1 23:05 CurrentCollectorMeterReadBackup20081201.tar.gz
-rw-r----- 1 pipe pipe 71315927 Dec 2 23:05 CurrentCollectorMeterReadBackup20081202.tar.gz
-rw-r----- 1 pipe pipe 71014908 Dec 3 23:05 CurrentCollectorMeterReadBackup20081203.tar.gz
-rw-r----- 1 pipe pipe 70006001 Dec 4 23:05 CurrentCollectorMeterReadBackup20081204.tar.gz
-rw-r----- 1 pipe pipe 72596207 Dec 5 23:05 CurrentCollectorMeterReadBackup20081205.tar.gz
-rw-r----- 1 pipe pipe 71755813 Dec 6 23:05 CurrentCollectorMeterReadBackup20081206.tar.gz
-rw-r----- 1 pipe pipe 71804873 Dec 7 23:05 CurrentCollectorMeterReadBackup20081207.tar.gz
-rw-r----- 1 pipe pipe 70321940 Dec 8 23:06 CurrentCollectorMeterReadBackup20081208.tar.gz
-rw-r----- 1 pipe pipe 71836264 Dec 9 23:05 CurrentCollectorMeterReadBackup20081209.tar.gz
-rw-r----- 1 pipe pipe 70717052 Dec 10 23:06 CurrentCollectorMeterReadBackup20081210.tar.gz
-rw-r----- 1 pipe pipe 73818543 Dec 11 23:05 CurrentCollectorMeterReadBackup20081211.tar.gz
-rw-r----- 1 pipe pipe 72596215 Dec 12 23:05 CurrentCollectorMeterReadBackup20081212.tar.gz
-rw-r----- 1 pipe pipe 71104767 Dec 13 23:05 CurrentCollectorMeterReadBackup20081213.tar.gz
-rw-r----- 1 pipe pipe 70855212 Dec 14 23:05 CurrentCollectorMeterReadBackup20081214.tar.gz
-rw-r----- 1 pipe pipe 87294203 Dec 15 23:07 CurrentCollectorMeterReadBackup20081215.tar.gz

-----------------------------------------------------

Last edited by ali560045; 12-16-2008 at 06:05 AM..
# 10  
Old 12-16-2008
I asked you to just use 4 question marks instead of ${value}.
# 11  
Old 12-16-2008
Yes . I have made changes in the previous post i m able to do dir
# 12  
Old 12-16-2008
There is no filename with a 1020 in it.

Just checked it - when you use -v on ftp you should get a message like
Code:
450 blabla: No such file or directory

What happens if you use get instead of mget?

Last edited by zaxxon; 12-16-2008 at 07:39 AM..
# 13  
Old 12-16-2008
yes there is file on ddcappip031.tu.com

path is : ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles

Filename: CurrentCollectorMeterReadBackup20081020.tar.gz

ls -ltr CurrentCollectorMeterReadBackup20081020.tar.gz


-rw-r----- 1 pipe pipe 144570660 Oct 20 23:08 CurrentCollectorMeterReadBackup20081020.tar.gz

--------------------------------------------------------------------------
the problem is that in FTP is not recognising the value of $value as 1020
when using FTP -v it is showing

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

I tried with both mget and get option

Last edited by ali560045; 12-16-2008 at 08:59 AM..
# 14  
Old 12-16-2008
There is nothing wrong with the script version in Post #3. Note that the single quotes have been removed to allow expansion of ${value} .
The error message in Post #3 suggests that you have hit an old Linux bug in the FTP daemon. Either apply fixes or try specifying a directory name (with ./) on the mget line.

mget ./CurrentCollectorMeterReadBackup2008${value}.tar.gz

Last edited by methyl; 12-16-2008 at 12:54 PM..
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