Solved

compress and decompress

Posted on 2006-11-07
1
296 Views
Last Modified: 2010-04-20
hello,
I need to compress 50 files from /home/pictures
and then extract them in /home/pictures2
but pictures2 has some files so I dont want to overwrite them!
how can I do this ?
0
Comment
Question by:Sabrin
1 Comment
 
LVL 58

Accepted Solution

by:
amit_g earned 500 total points
ID: 17894280
cd /home/pictures
tar -cf - * | gzip -c > all_files.tar.gz
cd /home/pictures2
gunzip -c all_files.tar.gz | tar -k -xf -

You might be able to do this in single command if you don't want to compress

tar -cf - -C /home/pictures . | tar -k -xpf - -C /home/pictures2

Always test on a smaller test directory before running it on real one.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now