dev
dev

Reputation: 981

zip in UNIX and Windows

Hi all I have to zip all files in a directory in UNIX and then FTP it to uniz

I have tried

tar -cvf abc.tar.gz folder

zip abc.tar.gz folder

but these files are not readable after ftp

I copied these files to local by simple FTP but windows giving error that "File is corrupted"

Please help

Upvotes: 0

Views: 2374

Answers (3)

vishy12
vishy12

Reputation: 45

You would have to do two things to get your content compressed and transferred correctly:

  1. add 'z' along with -cvf to enable gzip compression

    tar -cvfz abc.tar.gz folder
    
  2. Once you are connected to the FTP host, type binary in the prompt to change your charset mode to binary from ASCII before you type your put command.

    ftp>binary
    ftp>put abc.tar.gz
    

Upvotes: 0

Cyrille
Cyrille

Reputation: 14573

One possibility is that you might be using your ftp client's ASCII mode to send your archives. Make sure to use binary mode.

In ASCII mode, your binary files will get corrupted as, for example, newlines are converted.

FTP servers are usually set on binary/auto mode by default, maybe this one is set on ASCII mode instead.

Upvotes: 1

Luca Guglielmi
Luca Guglielmi

Reputation: 131

You need the "-z" option to zip (gzip) the tar. Something like this:

tar -cvzf abc.tar.gz folder

Upvotes: 0

Related Questions