Friday, September 6, 2013

Using tar pipe for copying directory excluding files or directories.

A nice use case for tar pipe

Say we have a directory, with tons of subdirectories, each of which is a checked subversion project.
Dir structure looks like this.

RootDir / 
  /dir1/
    .svn
    dirs....
  /dir2/
    .svn
    dirs....

One wants to copy everything but .svn dirs.

Let's use tar pipe for that: 

tar --exclude \.svn -c RootDir | tar -C /path/to/destination/ -xv


No comments:

Post a Comment