Solved

Unix / Linux Command question

Posted on 2007-04-08
4
268 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 34

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SMB share across internet 15 115
IMAP copying tool 14 76
Windows 10 linux VM 30 92
Cron job never runs on vCenter 6.5 appliance 7 34
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

751 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