zipping files

Posted on 1997-08-29
Last Modified: 2010-04-21
Is there a command to have all my html files zipped up for storage andr future download (copys not add/delete)?
Question by:bstorm
  • 4
  • 2
  • 2
LVL 84

Expert Comment

ID: 2006883
zip *.html

tar cBf - *.html | gzip > html.tar.gz


Accepted Solution

theTerabyte earned 50 total points
ID: 2006884
I always forgot the command to unzip them- you'll need that too!
if you use the tar command to compress them, use this command to uncompress them:
tar -xvf html.tar.gz /target_path
hope you feel like giving up some points for this tidbit sccince ozo gave the ans away(like 10 or 20) but you don't have to obviously.

LVL 84

Expert Comment

ID: 2006886
Or if you don't have a tar that knows about .gz files, you might use:

zcat html.tar.gz | (cd /target_path; tar xBf -)

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.


Expert Comment

ID: 2006887
had to oneup me, eh?  oh well, i don't know as much about UNIX as i'd like to anyway....
LVL 84

Expert Comment

ID: 2006888
No, I learned something too.
I just noticed in the gzip man pages a mention that gnu tar
has a -z option for compressed archives...



Author Comment

ID: 2006889
here's part of the telnet log...
rapidnet: {6} % zip *.html
zip: No match.
rapidnet: {7} % tar cBf - *.html | gzip > html.tar.gz
tar: No match.
rapidnet: {8} % man gzip of these worked...will read the manual when I get a chance...
am quite afraid of creating a Zip that will replace them instead of merely adding them to an arcive...couldn't get this to oze...
LVL 84

Expert Comment

ID: 2006890
> rapidnet: {6} % zip *.html
> zip: No match.
This error looks like it means that there are no *.html files in your cwd
are the files named *.html?

What if you say
zip pathtohtmlfiles/*.html

cd pathtohtmlfiles
zip *.html

But is your fear that it will replace files already in an exixting zip archive?
I had previously understood your fear to be that it would
remove the original files when it created the archive.

In either case, perhaps your fear could be aleviated by making
a copy in another directory of the files you don't want to be

Author Comment

ID: 2006891
ozo deserves the grade of A his answer was correct, I hadn't changed directories to where they were, but when I did, his command worked perfectly. For some reason I can't give ozo the credit, so this will make 100 points spent trying to get him his credit.

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IBM AIX Cannot Install AIX ToolKit Applications for Linux 11 150
netstat -a in AIX unix 8 42
Hyper-threading config in Solaris 6 133
unix example issues 18 90
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question