Oh yeah,
you're right,
rumi78, that's this confusion with "indata" and "outdata" I already mentioned!
With "put" the solution would be fine ;-)
Anyway, I once had a similar case here, where I provided a solution looking like this:
#!/bin/sh
HOST="xxxxxx"
USER="heather"
PASSWD="*******"
CMDFILE="/tmp/rc.ftp.$$"
REMOTEDIR="/usr/indata"
LOCALDIR="/usr/outdata"
PATTERN="*2010020214*"
NUMFILES=10
LISTING=$(ftp -in $HOST <<EOF
user $USER $PASSWD
cd $REMOTEDIR
ls $PATTERN
quit
EOF )
SLISTING=$(echo $LISTING | cut -f1-$NUMFILES -d" ")
echo "open $HOST" > $CMDFILE
echo "user $USER $PASSWD" >> $CMDFILE
echo "verbose" >> $CMDFILE
echo "ascii" >> $CMDFILE
echo "cd $REMOTEDIR" >> $CMDFILE
echo "lcd $LOCALDIR" >> $CMDFILE
for FILE in $SLISTING
do
echo "get $FILE" >> $CMDFILE
done
echo "quit" >> $CMDFILE
ftp -in < $CMDFILE
rm $CMDFILEBasically, we use FTP to create a remote listing to then process the first 10 elements in a second FTP step.
wmp