Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 8 '11 at 20:26
    
It's Rackspace Cloud Sites, believe it or not. No SSH, SFTP or RSYNC allowed :-( –  Jakobud Dec 8 '11 at 20:35

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
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... –  Jakobud Dec 9 '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. –  Iain Dec 9 '11 at 22:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.