Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-30-2012, 02:13 AM
|
#1
|
LQ Newbie
Registered: Apr 2012
Posts: 4
Rep:
|
TAR Exclude everything in folder except this folder
Hello, I want to create a backup of my Home folder. Here's what I've done.
Code:
GZIP=-9
time=`date "+%y.%m.%d.%H.%M.%S"`
tar cvzf "/home/raza/Ubuntu One/$time.backup.tar.gz" \
--exclude="*.tmp" \
--exclude-caches-all \
--exclude="/home/raza/backup.sh" \
--exclude="/home/raza/*[Cc]ache*" \
--exclude="/home/raza/*[Tt]humbnails*" \
--exclude="/home/raza/*[Ii]cons?*" \
--exclude="/home/raza/*[Ll]ogs?*" \
--exclude="/home/raza/.opera/vps" \
--exclude="/home/raza/.opera/temporary_downloads" \
--exclude="/home/raza/Downloads" \
--exclude="/home/raza/Ubuntu One" \
--exclude="/home/raza/.local/share/Trash" \
"/home/raza/" > fileSaved.txt
There's a folder called /home/raza/.config/sublime-text-2/ that I want to exclude EXCEPT this this directory /home/raza/.config/sublime-text-2/Packages/User.
How do I do that?
Thank You.
|
|
|
04-30-2012, 02:39 AM
|
#2
|
Member
Registered: May 2008
Location: NRW/Germany
Posts: 105
Rep:
|
Hi
how about adding these files after the first tar:
Code:
# to be included
tar avzf "/home/raza/Ubuntu One/$time.backup.tar.gz" \
/home/raza/.config/sublime-text-2/Packages/User \
>> fileSaved.txt
|
|
1 members found this post helpful.
|
04-30-2012, 03:28 AM
|
#3
|
LQ Newbie
Registered: Apr 2012
Posts: 4
Original Poster
Rep:
|
I tried that too, it didn't work. It gave me no errors, just didn't archive it.
Edit:
Ohhhh, I get it, I'll try that.
Last edited by rationalthinker1; 04-30-2012 at 03:29 AM.
|
|
|
04-30-2012, 09:26 AM
|
#4
|
LQ Newbie
Registered: Apr 2012
Posts: 4
Original Poster
Rep:
|
I tried:
Quote:
tar avzf "/home/raza/Ubuntu One/$time.backup.tar.gz" \
/home/raza/.config/sublime-text-2/Packages/User \
>> fileSaved.txt
|
tar: You must specify one of the `-Acdtrux' or `--test-label' options
Try `tar --help' or `tar --usage' for more information.
Quote:
tar rvzf "/home/raza/Ubuntu One/$time.backup.tar.gz" \
/home/raza/.config/sublime-text-2/Packages/User \
>> fileSaved.txt
|
tar: Cannot update compressed archives
Try `tar --help' or `tar --usage' for more information.
Again, thank you.
|
|
|
04-30-2012, 09:46 AM
|
#5
|
Member
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190
Rep:
|
you are actually trying to updating a compressed archive that will not work for adding files later on. first you need to create uncompressed tar package and than Add file with "r" than compress it. using gzip
First Part
Quote:
GZIP=-9
time=`date "+%y.%m.%d.%H.%M.%S"`
tar cvf "/home/raza/Ubuntu One/$time.backup.tar" \
--exclude="*.tmp" \
--exclude-caches-all \
--exclude="/home/raza/backup.sh" \
--exclude="/home/raza/*[Cc]ache*" \
--exclude="/home/raza/*[Tt]humbnails*" \
--exclude="/home/raza/*[Ii]cons?*" \
--exclude="/home/raza/*[Ll]ogs?*" \
--exclude="/home/raza/.opera/vps" \
--exclude="/home/raza/.opera/temporary_downloads" \
--exclude="/home/raza/Downloads" \
--exclude="/home/raza/Ubuntu One" \
--exclude="/home/raza/.local/share/Trash" \
"/home/raza/" > fileSaved.txt
|
Second Part
Quote:
tar rvf "/home/raza/Ubuntu One/$time.backup.tar" \
/home/raza/.config/sublime-text-2/Packages/User \
>> fileSaved.txt
|
third part
Quote:
gzip -9 /home/raza/Ubuntu One/$time.backup.tar
|
I am Pretty much sure that it will work perfectly.
Thanks,
em31amit
Amit M.
|
|
2 members found this post helpful.
|
04-30-2012, 09:20 PM
|
#6
|
LQ Newbie
Registered: Apr 2012
Posts: 4
Original Poster
Rep:
|
Yes, that works perfectly.
Thank you.
For reference:
Code:
GZIP=-9
time=`date "+%y.%m.%d.%H.%M.%S"`
tar cvpf "/home/raza/Ubuntu One/$time.backup.tar" \
--exclude="*.tmp" \
--exclude-caches-all \
--exclude="/home/raza/*[Cc]ache*" \
--exclude="/home/raza/*[Tt]humbnails*" \
--exclude="/home/raza/*[Ii]cons?*" \
--exclude="/home/raza/*[Ll]ogs?*" \
--exclude="/home/raza/.opera/vps" \
--exclude="/home/raza/.opera/temporary_downloads" \
--exclude="/home/raza/Downloads" \
--exclude="/home/raza/Ubuntu One" \
--exclude="/home/raza/.local/share/Trash" \
--exclude="/home/raza/.config/sublime-text-2" \
--exclude="/home/raza/.thunderbird/*/ImapMail" \
"/home/raza/" > fileSaved.txt
tar rvpf "/home/raza/Ubuntu One/$time.backup.tar" \
"/home/raza/.config/sublime-text-2/Packages/User" \
>> fileSaved.txt
gzip -9 "/home/raza/Ubuntu One/$time.backup.tar"
Last edited by rationalthinker1; 04-30-2012 at 09:22 PM.
|
|
|
All times are GMT -5. The time now is 02:34 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|