BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old January 11th, 2005, 10:08 PM
mystik_web's Avatar
mystik_web mystik_web is offline
No one Important
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Australia
Posts: 524 mystik_web User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 38 m 24 sec
Reputation Power: 8
Send a message via ICQ to mystik_web
tar creation - Wildcards

Hello there, I was wondering if anyone could help me.

I would like to know if there is an easy way of creating a tar file, but only allowing files of specific types? ie .php* or .plib

If anyone knows that would be great....

Reply With Quote
  #2  
Old January 12th, 2005, 05:32 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
You can use "find" to feed filenames to tar, eg.
Code:
find . -name '*.php*' | tar czf filename.tgz -T - 


hth,
M.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #3  
Old January 12th, 2005, 04:39 PM
mystik_web's Avatar
mystik_web mystik_web is offline
No one Important
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Australia
Posts: 524 mystik_web User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 38 m 24 sec
Reputation Power: 8
Send a message via ICQ to mystik_web
Quote:
Originally Posted by M.Hirsch
You can use "find" to feed filenames to tar, eg.
Code:
find . -name '*.php*' | tar czf filename.tgz -T - 


hth,
M.



Thanks for the command, I tried it, however it included symbolic links in the tar file aswell, is there a way I can run 'find -type f' or something? so that it only includes actual files....

Any help would be great.

Reply With Quote
  #4  
Old January 12th, 2005, 05:06 PM
nbarraud nbarraud is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 12 nbarraud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 23 sec
Reputation Power: 0
Yep I think there is such an option. You should check man find to know more about this.

Reply With Quote
  #5  
Old January 12th, 2005, 05:37 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
Quote:
Originally Posted by mystik_web
Thanks for the command, I tried it, however it included symbolic links in the tar file aswell, is there a way I can run 'find -type f' or something? so that it only includes actual files....

Any help would be great.

What do you want instead? The files the symlinks are pointing to? Or leaving them out completely?
"-type f" for find should work if you don't want to include them at all, parameter "-h" to tar would dump the files the symlinks are pointing to instead of the links.

As nbarraud pointed out already: The "man pages" are a must-read for unix admins. Type "man tar" and "man find" to see all those other fancy functions

M.

Reply With Quote
  #6  
Old January 12th, 2005, 07:10 PM
mystik_web's Avatar
mystik_web mystik_web is offline
No one Important
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Australia
Posts: 524 mystik_web User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 38 m 24 sec
Reputation Power: 8
Send a message via ICQ to mystik_web
Hey thanks for that, yeah I looked again in the man pages, and ended up using the -type -f so it did not include the the links, but only the main files.

I did read the man pages , was just having a blonde moment, and still getting used to be able to 'pipe' one command into other programs etc.

Cheers for the help guys, its appreciated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > tar creation - Wildcards


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway