Solved

compress and decompress

Posted on 2006-11-07
1
301 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

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