PDA

View Full Version : Files are not the same after copy


thing2b
15-Mar-2006, 08:02 PM
I am connecting to an FTP server hosted on linux and copying

some of the files to my local windows computer. All the text

files on the windows side end up double spaced (just like this post) when they should not be.

I do a plain and simple copy through beyond compare from the ftp to the computer.

I then do a binary compare (or size and CRC) between the 2 copied files and they are not equal.

Why does the copy not just make the 2 files equal?

How can I make the files equal.

It would be really nice if I could stop my php files from being double spaced... :(

thing2b
15-Mar-2006, 08:52 PM
I am connecting to an FTP server hosted on linux and copying

some of the files to my local windows computer. All the text

files on the windows side end up double spaced (just like this post) when they should not be.

I do a plain and simple copy through beyond compare from the ftp to the computer.

I then do a binary compare (or size and CRC) between the 2 copied files and they are not equal.

Why does the copy not just make the 2 files equal?

How can I make the files equal.

It would be really nice if I could stop my php files from being double spaced... :(



If I force the FTP transfer type to be binary every time, I get an exact copy, and I no longer have every line separated by 2 spaces. Is there any negative implications from transfering a text file through FTP Binary mode?

Craig
16-Mar-2006, 10:41 AM
Short answer is no, there shouldn't be any negative consequences in this case.

Long answer:

The "Transfer Type" handles differences in file encodings between Windows, Mac, and Unix systems. Windows uses the carriage return character followed by the line feed character to mark the end of a line, Macs use just a carriage return, and Unix uses just a line feed. Normally you transfer text files as ASCII, which converts the files into a standard format while it's being transferred, and then it's converted to the server or client's encoding when it arrives.

For example, on your system all of your files have a CR/LF, but if you transfer them to a Unix system they'll end up with just a LF, and the programs that run on that system will be able to handle it. If you transferred the files as binary instead, they wouldn't be converted, so they would have CR/LFs on the server too. So the reason the files are different is because they really are different on each side, and would be different sizes.

As for why your getting double spaced files, I would guess that the files were originally transferred from a Windows server to a Unix server in binary mode, so they ended up with a CR/LF on the Unix FTP server. When you downloaded it from the server in ASCII mode it tried to change all of it's LF line endings to CR/LF endings, which ended up being sent as CR/CR/LF. So in this case the correct thing to do would be to download them in binary so they just have the regular CR/LF.