ftp. copy if size differs

Hi.
On my system there is a script which making backup to ftp site. But it leaves copy of files on local machine. Then i go to Midnight Commander and check manually with MC features - i open ftp directory and copy files <if size differs>.

So, how can i do the last thing in shell or other language - copy to ftp site only if size of local files and ftp files differs. And then delete, if not.

Does your FTP site also support the rsync command? It is much better at handling things like that.

Otherwise you could do ls via FTP and use sed or awk to extract the size. Then with regular shell scripting compare, transfer, delete.