0

I am facing an crc error/length error on .gz file of a file to server.

While manually retrieving the file, I am getting a size 1932 bytes and gunzips fine without any problem.

But when I retrieve it through a shell script, the file arriving is 1931 bytes.

Funny part is I am ftping 3 files and 2 of them are arriving correctly.

This is how I automated it :

echo "user $username $password" > $BATCH

echo "get reston.txt.gz reston.txt.gz" >> $BATCH
echo "get tuffnel.txt.gz tuffnel.txt.gz" >> $BATCH
echo "get atlanta.txt.gz atlanta.txt.gz" >> $BATCH

echo "exit" >> $BATCH

ftp -n -v $ipaddress < $BATCH > $LOG

then

gunzip *.txt.gz

tuffnel, atlanta works fine, reston wont gunzip unless downloaded manually.

Thanks in advance, Lebu

Lordlebu
  • 411
  • 1
  • 6
  • 15

1 Answers1

1

Maybe FTP defaults to ASCII/text mode? try "BIN" as the first command:

echo "user $username $password" > $BATCH
echo "BIN" >> $BATCH

echo "get reston.txt.gz reston.txt.gz" >> $BATCH
echo "get tuffnel.txt.gz tuffnel.txt.gz" >> $BATCH
echo "get atlanta.txt.gz atlanta.txt.gz" >> $BATCH

echo "exit" >> $BATCH

ftp -n -v $ipaddress < $BATCH > $LOG
wildplasser
  • 43,142
  • 8
  • 66
  • 109
  • does changing the order of files sent change the file that has the error? If its the last file in the group that always fails, then maybe you can add a dummy file as the last one? Good luck. – shellter Jun 22 '12 at 14:36