I have been trying to zip and unzip a directory.
I used gzip -c -r <directory> to recursively search the directory and zip it
Now is want to unzip the directory, by
gunzip -r <filename>.gz
The problem is that the unzip creates on file with the contents of all the files in it. No the entire directory with sub-directories and files
gzip is designed to compress files. The "problem" here is that everything on a unix filesystem is a "file" including a directory. the content of a "directory file" are the underlying files. That is what you see.
therefor you need "tar" or "cpio" or whatever you like to create one "file" that is compressed later.
There is no need to worry about tar and friends. you can use tar -xzf <file> to extract and tar -czf <file> <dir> to create without seeing gzip at all. tar offers a pletora of other options also.