Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am transferring a file from a linux pc going to a windows ftp server using "ftp put". My file is a zip file that includes .txt files inside it.

Here is what's happening when I transfered this file :

  1. I used ftp put for transferring and found that my transferred zip file was corrupted and couldn't be opened on the ftp server.
  2. I found the solution for this on the internet. I needed to use 'binary' to make it right.
  3. I transferred again using binary and then ftp put the zip file onto the other end. Yes, it worked. My zip file wasn't corrupted anymore and I could already opened it on the ftp server. But the problem remains on the .txt files inside it. Converting the file into binary made my .txt files to be distorted and unreadable. I read from the internet that .txt files need to use Ascii instead of Binary to be readable, but if I use ascii it would cause my zip file to be corrupted again.

Is there any way to solve this? I need to successfully transfer a zip file that contains .txt files using ftp put.

share|improve this question

migrated from stackoverflow.com Sep 13 '11 at 8:27

This question came from our site for professional and enthusiast programmers.

    
Duplicate question - superuser.com/questions/334941/… –  Praveen Sripati Sep 14 '11 at 6:30
add comment

4 Answers 4

Converting the file into binary made my .txt files to be distorted and unreadable.

Incorrect. The files have not been changed in any way, including the line endings. Stop using Notepad to read text files; there are so many better tools to use.

share|improve this answer
add comment

The file has not been changed, since it was in the zip, and the FTP doesn't know anything about zip files and their content.

As a side note, the reason for Binary/ASCII modes on FTP is that different operating systems have different conventions for terminating lines. For linux and Windows those are different, and you should use ASCII to transfer txt files so the line endings are converted. But zip files do not have "lines", and they don't need to be converted.

As the previous answers pointed out, you should use a text editor that is able to handle different conventions for line endings.

Or you can convert the file to dos line endings before archiving it:

todos file.txt

You should be able to convert it on windows side also, (see: http://www.thefreecountry.com/tofrodos/)

share|improve this answer
add comment

You have already zipped up the file and used binary transfer. The ftp process will not in any way , try to modify those text files inside this zip file. Use Wordpad instead of Notepad to view your files.

share|improve this answer
add comment

I would recommend Notepad++. It has a lot more functionality - especially if you are programming - and is free.

share|improve this answer
add comment

Your Answer

 
discard

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