Optimize file transfer logic.