Don't re-invent the wheel.
1) Install rsync instead, which is designed with syncing in mind.
2) ftpsync
was written a decade ago. Perhaps it has been updated since.
3) lftp syncs over FTP and is
being actively maintained.
4) Perl package turbo-ftp-sync
may also fit the bill.
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.