Page 1 of 1
Copying files from UNIX server question
Posted: 2011-02-18, 13:45 UTC
by Boofo
Is there a way to set TC to save a file downloaded through FTP in the UNIX file format? It saves it to windows format now, but if I make a file in EditPlus with the UNIX format, it will stay the exact same size after I upload it. It doesn't do that with windows format. The file size is always smaller on the server after I upload a windows file to the unix server.
Posted: 2011-02-18, 17:13 UTC
by Sob
Set transfer mode to binary.
Posted: 2011-02-18, 17:38 UTC
by Boofo
Sob wrote:Set transfer mode to binary.
Thank you, that did the trick. But I need to ask, will it cause any problems that I am not thinking of? I only want it to work on PHP and text files.
Posted: 2011-02-19, 17:20 UTC
by Sob
Probably not. Binary mode just transfers files as they are, while text mode converts line endings. No further difference. So in case you have file with Windows line endings, it will be transfered to server without changes. For web pages it doesn't matter, web server just sends them to client and does not care about the content. But if you write e.g. some shell script on Windows, forget to convert Windows line endings to Unix ones and upload it using binary mode, then the system won't like it much.
Posted: 2011-02-19, 19:16 UTC
by Boofo
Ahh, okay. Then it would matter in s small number of cases. Thank you very much for the explanation.
Posted: 2011-02-21, 14:08 UTC
by petermad
You may consider editing the line:
[General]
ASCII=
In your wcx_ftp.ini file - it determines which file types that should be treated as non-binary files in Automatic mode. Remove *.txt and .php form this line if you have them there.
Posted: 2011-02-21, 14:44 UTC
by Boofo
Excellent, thanks! That is actually easier. Would it be OK to do XML in binary too or is that not a good thing to do?
Posted: 2011-02-22, 05:11 UTC
by ado
sure, XML is binary fine too. I am actually transferring tons of files between Win/Solaris back and fort via TC build in FTP and I am using only and only binary mode. If I need to transfer shell script that requires unix delimiters, I am saving that file as an Unix file (in Textpad).
...in fact as far as I know windows native Notepad.exe is the only editor that cannot handle unix line delimiters correctly
ado
Posted: 2011-02-22, 07:25 UTC
by Boofo
It would be wise to transfer htm and html files as text, though, wouldn't it?
What kind of shell scripts are you meaning? I guess I haven't done any of those yet.
Posted: 2011-02-22, 08:21 UTC
by frenky
It would be wise to transfer htm and html files as text, though, wouldn't it?
Unless the bandwidth is an issue, I would advise against ASCII mode transfer in general as it can introduce some problems that are sometimes hard to notice. Also, IMHO, this is a bad transfer option as you can not be sure that you have 1:1 copy... And sometimes, somewhere at some point you'll run into problems. I know I had, so I now only use binary, never ASCII.
Posted: 2011-02-22, 08:31 UTC
by Boofo
Won't html files get weird characters in them from binary transfer? Are there any files that are transferred safer as ASCII than binary? I just want to make sure I have all my bases covered.
Posted: 2011-02-22, 23:05 UTC
by Sob
The translation done by text mode does not affect anything except line endings. Direction from Windows to Unix takes CR+LF and converts it to bare LF. And the other way does the opposite. For html files it makes no difference, browsers don't (and even can't) care about line endings, because they must support both. Unlike character sets, there's no attribute to specify what type of line endings html document uses.
The only weird character you could see is ^M if you open the file with Windows line endings in Midnight Commander's editor on Unix system (possibly in other editors too, but I usually only use the one in MC).
Personally I always use binary mode, because I don't like some FTP server messing with my files. I know best what kind of line endings I want. :)
Posted: 2011-02-22, 23:13 UTC
by Boofo
Thank, guys, for all the info. I have set the default mode to binary now and will leave it as such. I have learned a lot in this thread.
