Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question FTP Put a zip file that contains text files in Linux

    Hi all,

    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.

    Please help.
    Thank you very much for any quick and kind response.

  2. #2
    The file you transferred is a binary (zip.) The contents of the zip are not modified by the transfer. You are seeing the fact that Windows (notepad/wordpad) do not use the same formatting as "text" files created on *Nix systems (thank MSFT.) You will find plenty of information via Google.

    Try opening your text file on Windows with a "smarter" editor such as SourceEdit, Textpad, etc.

  3. #3

    I've got another question for this isn't still clear for me.
    If the contents of the zip aren't supposed to be affected by the transfer, why is it that when I tried to transfer my text file as is like :
    put mytext.txt I was able to open it on the windows ftp server and the file wasn't distorted.

    Anyways, you were right regarding the conflict of text files between linux and MS coz when I opened the txt files inside my zip folder using Wordpad, they became perfectly readable.

    Is it true that I could use 'unix2dos' command before the actual ftp transfer?
    I tried this :

    unix2dos mytext.txt

    but it results to another problem, it says:
    bash: unix2dos: command not found

    what should I do with this?
    Thanks very much for your response to me.

  4. $spacer_open
  5. #4
    Assuming your software repos are set up, you can use SUSE's package manager (YAST or YAST2 I guess) to install the unix2dos package (which provides the command of the same name that was not found on your system). If memory serves, there's a graphical tool, as well as a command line interface, to YAST.

  6. #5
    Found the answer.

    FTP Transfer of zip file from linux to windows server doesn't affect the contents of the zip file. I am generating my text files dynamically through java code and what actually happens is that text files transferred to windows ftp server uses the line ending \r\n instead of just plain newline ( \n ).

    I just changed my line endings into \r\n to make it work and be readable when opened even on notepad ('coz I am really required to open the files using notepad).

    Thank you so much for all your help ^.^

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts