Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I copy a directory tree but exclude .svn directories?

Tags:

svn

Here is the problem:

Loop through all files and subfolders copying all contents EXCEPT .svn into another location.

I can think of some pretty hairy ways to do this but am wondering if anyone knows a real simple function to save me a bit of time? Thanks.

like image 459
Christopher Peterson Avatar asked Oct 29 '10 17:10

Christopher Peterson


People also ask

How do I remove all .SVN from a folder?

You can remove all dot files in a folder using find and rm . It searches for all dot files in the given folder, passed the results to rm which deletes it.

How do I delete a .SVN folder recursively?

The find command returns a list of all the subfolders matching “. svn”, and this is then piped to the rm command to recursively delete the directory. Running rm using the full path will remove the confirmation prompt, and the “rf” arguments will recursively delete any folder contents.

What are .SVN folders?

In particular, each directory in your working copy contains a subdirectory named . svn, also known as the working copy's administrative directory. The files in each administrative directory help Subversion recognize which files contain unpublished changes, and which files are out of date with respect to others' work.

How do I copy a directory in SVN repository?

The easiest way to copy files and folders from within a working copy is to use the right drag menu. When you right drag a file or folder from one working copy to another, or even within the same folder, a context menu appears when you release the mouse.


2 Answers

You can use the svn export command. It will populate a target folder with the content of a working copy (or a revision on a repository).

like image 178
xtofl Avatar answered Nov 17 '22 01:11

xtofl


Use rsync and the --exclude switch.

… although in this specific case, the better option is svn export

like image 27
Quentin Avatar answered Nov 16 '22 23:11

Quentin