2

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?

Jake Wilson
  • 8,494
  • 29
  • 94
  • 121
  • 2
    Not an answer, but I would immediately switch hosts if mine forced me to use FTP. That's just begging to have your password sniffed and your site destroyed. – MDMarra Dec 08 '11 at 20:26
  • It's Rackspace Cloud Sites, believe it or not. No SSH, SFTP or RSYNC allowed :-( – Jake Wilson Dec 08 '11 at 20:35

1 Answers1

7

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.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • Is there a reason that when I transfer files that are on a Linux server to Rackspace's Cloud Sites (which I assume uses some form of Linux) using ASCII that it changes the newline characters? I thought the conversion of `\n` <-> `\r\n` only happened between like Windows and Linux. Seems like if I'm going from Linux -> Linux that ASCII mode shouldn't affect the file sizes at all... – Jake Wilson Dec 09 '11 at 19:47
  • I have to say I really don't understand that but if it's Linux to Linux then there really shouldn't be any problems with binary mode. – user9517 Dec 09 '11 at 22:09