Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to add a directory structure to an SVN repository without adding the files contained in the folders?

share|improve this question
up vote 51 down vote accepted

So sorry, I should've RTFM ...

You can add a directory without adding its contents:

$ svn add --depth=empty otherdir
A         otherdir

Edit: This doesn't work recursively though, is there any way to do that too?

share|improve this answer

If you want to do it recursively, maybe this will work for you?

find . -type d ! -name '.' ! -path "*.svn*" -print0 | xargs -0 svn add --depth=empty
share|improve this answer
The problem is that the "svn add" will automatically recurse and include the contents of the directories. You'll need to use 'svn add -N' instead I think to ensure that it only works on the directory and not any files inside. – James F Jul 31 '09 at 12:27
Oh right, as he said, will edit post – Kyle Brandt Jul 31 '09 at 12:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.