How do I go about compressing a folder (tar1) and sending that compressed folder to a different directory (lets say called tar2).
I checked the questions on here, and most of them are using a file, not a directory and I've been trying all combinations, but I can't get it to work right.
In my ~ I have:
tar1/ a.txt b.txt tar2/
Tar1/ has a test file called a.txt and b.txt in it. I want to compress that folder and place it in tar2/
So afterwards it would look like:
tar1/ a.txt b.txt tar2/ tar1.gz a.txt b.txt
I was trying
tar czvf tar2/ tar1/
(A reference book I had gave an example in that syntax, where the first path is the place you want to store it, and the 2nd path is what you want to create the archive of.
I've also tried somethings with -C as my destination:
tar cvzf tar1/ -C tar2/
Hoping that that would take tar1/ compress the directory and place that in tar2
I got this error
tar: Cowardly refusing to create an empty archive
tar --help' ortar --usage' for more information.
I'm on RHEL 6.7