Hi,
I have a problem while ftp'ing zip files one after the other from linux source directory to a ftp host machine. here is the shell script:
#!/bin/ksh
dir=data/dir1/dir2 # this dir is linux source directory where zip files located.
rmtdir='/home/'
echo $dir
for i in /$dir/*; do
if [ -f "$i" ]; then
file=$i
ftp -inv <<END_SCRIPT
open host
user x133 x133
ascii
put $file $rmtdir
#sleep 5
quit
END_SCRIPT
fi
done
When i run the above shell script, i see that filename (say 123.zip from source directory) that is ftp'd is re-named as home instead of 123.zip.
dir=data/dir1/dir2 # this dir is linux source directory where zip files located.
rmtdir='/home/'
echo $dir
for i in /$dir/*; do
if [ -f "$i" ]; then
file=$i
ftp -inv <<END_SCRIPT
open host
user x133 x133
binary
cd $rmtdir
put $file $rmtdir
quit
END_SCRIPT
fi
done
and it gave the following error:
local: /ep-data/pcats/CPS_RSPD1032/970HD.zip remote: /ep-data/pcats/CPS_RSPD1032/970HD.zip
229 Entering Extended Passive Mode (|||48492|)
450 File action is not taken.
?Invalid command.
221 Service closing control connection.
dir=data/dir1/dir2 # this dir is linux source directory where zip files located.
rmtdir='/home/'
cd $dir
ftp -inv <<END_SCRIPT
open host
user x133 x133
binary
cd $rmtdir
prompt off
mput *.zip
END_SCRIPT
Sorry if there is confusion created, but i'm trying to ftp one zip file at a time in one ftp session. If there are 100 zip files in linux source directory then 100 ftp sessions should be created and one zip file per session to be ftp'd to host machine's root directory.