0

I gzip a folder, transfer it to a remote location and then extract it to a folder. The problem is that this machine is a little unreliable and sometimes writes don't succeed and there can be zero-byte files or corrupted files (I verified the archive was correct and subsequent extractions worked fine).

I know that gzip files have CRC info in them, so I'm wondering if there's an easy way to do this:

  1. Download gzip
  2. Extract gzip
  3. Compare files on disk to gzip CRCs to verify extraction succeeded

1 Answer 1

0

gzip already checks it.

if ! gunzip FILENAME 
  echo "crc error"
fi
3
  • I'm having a lot of trouble confirming what you're saying. I can't see any docs which show that. I don't want to check that the file is valid within the archive, I wanted to check that the file on disk matches what is in the archive.
    – Kias
    Commented Nov 9, 2015 at 22:43
  • huh? gzip is not an archive.
    – Jasen
    Commented Nov 11, 2015 at 1:05
  • returning non-zero (which means false) on error is pretty standard for all *nix commands. gzip follows that
    – Jasen
    Commented Nov 11, 2015 at 3:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .