LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 02-25-2009, 10:06 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
Skip file when use tar


I want to use "tar" to backup some files from system , that includes some files & directory ( /usr /var /home ) , if I want to skip to tar a specific files & directory , can advise what can i do ? thx
 
Old 02-25-2009, 10:12 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
--exclude

is one way

See man tar for that

You can also select files with find, etc and pipe the output to tar. How you will do it depends a bit on the proportion of included to excluded files in a given directory tree. Perhaps you could give a bit more colour on what you are trying to do.
 
Old 02-25-2009, 11:48 PM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
As "billymayday" mentioned find will help you to specify the files or directories
here are some samples to use tar and find
Compress 30 days old files in current directory
#find . –type f –atime + 30 | xargs tar czvf name.tar.gz
Or
#tar czvf name.tar.gz ‘find . –type f –atime +30’
 
Old 02-25-2009, 11:51 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Have you tried that first entry? I'd have thought you needed to use -r (append) to an existing file. Not sure though.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar does not skip empty directories lrt Linux - Software 7 10-01-2007 12:23 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM
How do I have tar skip files already on destination HD? Bob Ross Red Hat 2 02-04-2004 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration