how to pass value through FTP.Below the script in k-shell
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
i used the above suggested command ,but getting the error as
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
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
#!/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
using dir i m able to get the file name but how to copy it using FTP
#!/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
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
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.