FTP – Is transferring ascii files in binary a bad thing

asciibinaryftp

We have a local development server that we develop websites on. To push a website live it is FTPed (SSH/SFTP/Rsync is not an option unfortunately) to our webhost.

I want to run some scripts that compare/diff sites on the development server vs. the sites on the web host server. This is pretty straightforward, however during the FTP transfers I've been using Auto (as opposed to Ascii or Binary) mode.

In the end, all the files (*.php, *.html, etc) are different files sizes than they are on the local development server. After some research I think this is because it converts a \n to \r\n during the transfer. As a result, diff see's the files as different, when doing a directory compare even though their content is really the same.

I've discovered that if I set the FTP to transfer everything as Binary, then there is no file size differences.

What I'm wondering, is there any potential harm that can come of transferring everything in Binary mode, even ASCII files? What could go wrong with this approach? And if nothing can go wrong, then what is the point of ASCII mode?

Best Answer

When using ASCII mode the receiving end is expected to convert the ASCII text into a format that is compatible with it's operating system e.g. (as you noted) \n can be converted to \r\n etc. A binary mode transfer is a byte for byte copy of the file from source to destination no translation is allowed or expected.

If your files run/display correctly when transferred in binary mode then there is no downside for you.