Compression – How to Compress a Directory

compressiongzipzip

I'm trying to compress a directory and ftp it to a windows ftp.

I have tried every tar command I can find to compress a directory. It appears to be ok. Then I transfer it and view it's contents using Winrar. Winrar keeps telling me the file is corrupted. I have viewed other .gz or .bz2 files using winrar but for some odd reason I can't get it to work.

I would prefer just to have it zip the files so they have a .zip extension but even then when i try to browse it's contents both windows and winrar claim it's corrupt.

Does anyone else have a suggestion as to something else to try?

Best Answer

Well, most probably your files are perfectly fine before FTP transmission.

Unfortunately, probably you are transferring your files using wrong FTP mode.

FTP do have two modes: binary and ASCII. By default most clients use ASCII mode, which breaks your binary files completely. I don't know which FTP client you are using, but for example in ncftp you can use command "binary" to switch to binary mode.

If you want to create ZIP files using Ubuntu (or almost any other Linux), use zip. You can install it to Ubuntu by running

sudo apt-get install zip

Then you can create zip file by running

zip -r compressed_filename.zip foldername

On related note, you should know that FTP is insecure transmission protocol. Consider switching to sftp, for example. There is many free ssh servers for Windows, including minimal OpenSSH port.

Related Question