Once you have to worry about whether files change, it becomes rather painful to do it with Net::FTP. The canonical approach to this problem is to put Perl aside and reach for
rsync instead. It's the right tool for the right job.
print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'