Solved

Unix / Linux Command question

Posted on 2007-04-08
4
269 Views
Last Modified: 2010-04-20
I'm building a tar file on a directory that contains subversion (".svn") subdirectories.

The problem is I want to tar us everything UNLESS!! it lives in a .svn sub directory.

The command I'm currently using is:
  tar -cvf mytar.tar myRootDir

How do I filter out any subversion directories?
0
Comment
Question by:tmonteit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 18874379
find myrootdir -name '*.svn*; -prune -or \! -type d -print | xags   tar -rvf -X mytar.tar
0
 
LVL 24

Accepted Solution

by:
slyong earned 200 total points
ID: 18874454
Hi,

I am not sure if I understand you correctly that you want to tar all the files "except" those that under the .svn subdirectory.  If that is the case, you can use the "exclude" flag:

$ tar -cvf mytar.tar myRootDir --exclude "myRootDir/.svn"
0
 
LVL 35

Assisted Solution

by:Duncan Roe
Duncan Roe earned 50 total points
ID: 18881339
GNU tar has its own mechanism to filter out unwanted directories - no need to use find, as slyong mentioned.
If you want to exclude *all* .svn directories, use

tar -cf mytar.tar --exclude .svn myRootDir

tar's default is *not* anchored - i.e. .svn can be a component anywhere in the directory tree
0
 

Author Comment

by:tmonteit
ID: 18947767
sylong had the right answer but duncan had the better explanation :  points split.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question