LinuxQuestions.org
Visit Jeremy's Blog.
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-11-2010, 02:47 AM   #1
saran_redhat
Member
 
Registered: May 2009
Location: chennai
Posts: 247

Rep: Reputation: 16
Compress one Folder


Hai Friends

I have one doubt. I have one folder in my linux server. that folder having lot of sub folder , text files , images etc...
I need to tar that file using tar command . my need is i dont want tar for that full folder. i want to tar only html and txt files only .
so how to do this

please advise me

i am using centos 5
 
Old 02-11-2010, 03:01 AM   #2
sohail0399
Member
 
Registered: Oct 2008
Location: Pakistan, Islamabad
Distribution: CentOS, Fedora, Solaris
Posts: 154

Rep: Reputation: 23
one simple solution is :

move or copy *.txt and *.jpg files to another directory and make of that.
 
Old 02-11-2010, 06:45 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
tar zcvf backup.tgz *.html *.jpeg

Untested(!)
 
Old 02-11-2010, 07:54 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by chrism01 View Post
tar zcvf backup.tgz *.html *.jpeg

Untested(!)
That won't go recursively into subfolders, and also it will spill into many files when extracted.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
compress folder in rar infonlinebr Linux - Newbie 5 03-17-2016 03:08 PM
how to compress ~130GB folder and erase original files at the same time arshadul Linux - Newbie 3 04-20-2009 07:48 PM
Compress folder to Zip file makan007 Red Hat 1 09-05-2006 05:27 AM
to compress a file or folder sanjay2004 Linux - Newbie 1 04-11-2006 09:28 AM
How to compress a folder deWin Linux - Newbie 3 11-11-2004 11:00 PM

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

All times are GMT -5. The time now is 12:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration