We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

zipping files

bstorm
bstorm asked
on
Medium Priority
332 Views
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)?
Comment
Watch Question

ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
zip html.zip *.html

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


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.

HOPE THIS HELPS!  Terabyte

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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 -)

had to oneup me, eh?  oh well, i don't know as much about UNIX as i'd like to anyway....
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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

Commented:
here's part of the telnet log...
rapidnet: {6} % zip html.zip *.html
zip: No match.
rapidnet: {7} % tar cBf - *.html | gzip > html.tar.gz
tar: No match.
rapidnet: {8} % man gzip ....so..neither 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...
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
> rapidnet: {6} % zip html.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 html.zip pathtohtmlfiles/*.html
?

or
cd pathtohtmlfiles
zip html.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
overwritten?
 

Author

Commented:
ozo deserves the grade of A ..as 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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.