I created a zip file on Linux environment. I wanted to transfer this zip file to another linux machine. For this, I uploaded the zip file to server using ftp. Now, after downloading the zip file on other server I tried to unzip it on other linux machine. Their I get following error -
gzip: <file name> : invalid compressed data--format violated
After some analysis and googling I found that reason for this error was the way I was uploading and downloading files from ftp server. When I used binary format to upload and download the zip file I was able to unzip it on other linux machine without any error.
Here are the commands that I used on linux file to zip and upload file -
$ gzip file.txt (This will create file.txt.gz file)
$ ftp <URL of ftp server>
$ ftp : <enter username and password to login>
$ ftp binary
$ ftp put file.txt.gz
Above commands will zip file.txt and upload that on server in binary format
On other linux machine I used following commands to download and unzip the file -
$ ftp <URL of ftp server>
$ ftp : <enter username and password to login>
$ ftp binary
$ ftp get file.txt.gz
$ ftp exit
$ gunzip file.txt.gz (This will unzip the file.txt)
gzip: <file name> : invalid compressed data--format violated
After some analysis and googling I found that reason for this error was the way I was uploading and downloading files from ftp server. When I used binary format to upload and download the zip file I was able to unzip it on other linux machine without any error.
Here are the commands that I used on linux file to zip and upload file -
$ gzip file.txt (This will create file.txt.gz file)
$ ftp <URL of ftp server>
$ ftp : <enter username and password to login>
$ ftp binary
$ ftp put file.txt.gz
Above commands will zip file.txt and upload that on server in binary format
On other linux machine I used following commands to download and unzip the file -
$ ftp <URL of ftp server>
$ ftp : <enter username and password to login>
$ ftp binary
$ ftp get file.txt.gz
$ ftp exit
$ gunzip file.txt.gz (This will unzip the file.txt)
Comments
Post a Comment