From the gzip man page:
gzip -r dirname
Travel the directory structure recursively. If any of the file names specified on the command
line are directories, gzip will descend into the directory and compress all the files it finds
there (or decompress them in the case of gunzip ).
compresses each file that it finds in dirname, but it does not do anything to dirname
This does not work:
gzip -r testdir > newfile
the gzip -r command compresses all the file that it finds in testdir, but does not write anything to newfile.
I think you need tar to do what you want----eg
tar -czf testdir.cmp testdir ##compresses testdir and its contents into "testdir.cmp"
tar -xzf testdir.cmp ##recreates testdir and its contents