LinuxQuestions.org
Help answer threads with 0 replies.
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 10-12-2007, 01:51 PM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Rep: Reputation: 31
want to 'tar' a folder without some contents of folder


Friends ,

Suppose I have a folder "test" . In test folder I have 5 files , Like "file1" "file2" "file3" "file4" and "file5" .

Now I want to compress (tar) the "test" folder without the file "file4" and "file5" .

Like follwing :

tar -cvf test.tar test //
it should not contain the 'file4' and 'file5' .

Is it possible to do ? If yes then plz help me ....
 
Old 10-12-2007, 01:53 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You should search for "exclude" in the tar manual page.
 
Old 10-12-2007, 01:58 PM   #3
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Code:
man tar
then type '/' (shift+7 if you've got a keyboard like mine) followed by 'exclude' without spaces, and hit ENTER. So,
Code:
/exclude
If you found what you wanted, read further -- if not, write again '/' (no need to retype the same search string unless you change it) and hit ENTER to head for the next hit. It works backwards the same way, except the "search letter" is '?', not '/'.
 
Old 10-12-2007, 02:01 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
If you use KDE you can also view manual pages in konqueror by entering
Code:
man:pagename
in the location bar.
 
Old 10-13-2007, 03:44 AM   #5
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Original Poster
Rep: Reputation: 31
exclude a folder using tar command

Thx all for reply ...

I can do it in the case of "file" format . But If I want to tar excluding a folder
Like /var or /myfolder Like following way :

tar -cvf test.tar --exclude /myfolder

Then it does not working .

Plz help how can I exclude a folder using tar ?
 
Old 10-13-2007, 04:21 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You left out the files it *should* tar up?
 
  


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
compare folder contents babysnake Linux - Newbie 4 02-09-2007 07:04 AM
Mounting a folder and contents as DVD drive?? JungMin Linux - General 8 04-18-2006 09:00 AM
Samba - XP can't list folder contents p0tw0r Linux - Networking 1 05-31-2005 03:37 AM
Cannot see contents of my folder nr4g3d Linux - Newbie 6 02-09-2004 03:01 PM
samba does not show folder contents Goma_2 Linux - Networking 0 12-10-2003 04:54 AM

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

All times are GMT -5. The time now is 02:18 PM.

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