Exclude svn files while copying in linux

SVN recursively populates .svn folders in all the children folders of a project under version control. There are a number of techniques to copy the parent folder without copying the .svn folders and files, but I find the following to be easiest and quickest.

amit@texens:~$ rsync -aC /path/to/srcdir/ /path/to/destdir

The trailing “/” on srcdir is to make sure that the contents of srcdir are copied to destdir. Without the trailing “/”, the destdir will contain the srcdir and everything will be one more level down.

One other option is to copy the directory without paying any heed to the .svn directories and then find and delete all the .svn folders using the following command.

amit@texens:~$ cp -r /path/to/srcdir/folder /path/to/destdir
amit@texens:~$ find /path/to/destdir -name '.svn' -exec rm -r {} \;

Advertisements

2 thoughts on “Exclude svn files while copying in linux”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s