I'm working on a Python script that will upload a bunch of files to an FTP site. To check to see whether the file has changed, I'm comparing file sizes. The problem is, the files I'm uploading have \r\n line endings, but transferring via FTP (ascii mode to a Linux box) converts to \n line endings. Obviously I'm losing a bunch of bytes in this process, so I can't compare file sizes any more.
I'm not sure the best way to proceed here. Convert from \r\n to \n on the fly when checking file sizes? Upload everything in binary mode? Stop comparing file size?