LinuxQuestions.org
Review your favorite Linux distribution.
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 07-26-2011, 02:13 AM   #1
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 294

Rep: Reputation: 10
Using Tar how to Exclude list of directories.


Hi all,

Using Tar i can able to exclude some of the directories

using this command

Code:
 tar -cpzvf /var/tmp/datea.tar /data  --exclude=
{android,blackberry,animated_favicon1.gif,build,build.xml,db,error.jsp,favicon1.ico}
But my requirement is to exclude nearly 200 directories, is it possible to do this,

I tried like this i mentioned 200 directories names in a file called exclude.txt

and tried this command

Code:
tar -cpzvf /var/tmp/datea.tar /data  --exclude=exclude.txt
But no luck is there any other options?? Please guide me to solve this thread.
 
Old 07-26-2011, 02:21 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
It should be
Code:
--exclude-from=exclude.txt
where the file exclude.txt must contain one pattern per line.
 
1 members found this post helpful.
Old 07-26-2011, 02:21 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Try
Code:
--exclude-from=/PATH_TO/exclude.txt
Kind regards
 
1 members found this post helpful.
Old 07-26-2011, 03:20 AM   #4
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 294

Original Poster
Rep: Reputation: 10
Hi colucix,repo

Thanks a lot man..you guys made my day..it works great :-)
 
  


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
tar exclude directories kais1 Linux - Newbie 1 10-13-2009 09:01 AM
CVS Exclude : Exclude sub directories from check out On Linux from command line shajay12 Linux - Newbie 1 08-03-2009 12:36 AM
How to exclude directories in tar? depam Linux - General 3 05-07-2007 08:23 PM
Tar won't exclude directories. yougene Slackware 9 12-01-2005 09:32 AM
Exclude directories when backing up with 'tar'? wolfpeach Linux - Newbie 2 06-28-2004 10:54 AM

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

All times are GMT -5. The time now is 01:04 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