LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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
 
Thread Tools
Old 10-12-2007, 02:51 PM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 392
Thanked: 0
want to 'tar' a folder without some contents of folder


[Log in to get rid of this advertisement]
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 ....
shipon_97 is offline     Reply With Quote
Old 10-12-2007, 02:53 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu (x86), Debian (PPC)
Posts: 3,495
Thanked: 6
You should search for "exclude" in the tar manual page.
matthewg42 is offline     Reply With Quote
Old 10-12-2007, 02:58 PM   #3
b0uncer
Senior Member
 
Registered: Aug 2003
Location: fin
Distribution: (B)LFS, Ubuntu, Slackware
Posts: 4,854
Thanked: 27
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 '/'.
b0uncer is offline     Reply With Quote
Old 10-12-2007, 03:01 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu (x86), Debian (PPC)
Posts: 3,495
Thanked: 6
If you use KDE you can also view manual pages in konqueror by entering
Code:
man:pagename
in the location bar.
matthewg42 is offline     Reply With Quote
Old 10-13-2007, 04:44 AM   #5
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 392
Thanked: 0

Original Poster
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 ?
shipon_97 is offline     Reply With Quote
Old 10-13-2007, 05:21 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 16,716
Blog Entries: 30
Thanked: 283
You left out the files it *should* tar up?
unSpawn is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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


All times are GMT -5. The time now is 04:36 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration