# How do I exclude the /log directory from svn repository?

**URL:** <https://www.ruby-forum.com/t/how-do-i-exclude-the-log-directory-from-svn-repository/142199>\
**Category:** Deployment\
**Created:** [July 4, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/how-do-i-exclude-the-log-directory-from-svn-repository/142199 "2008-07-04T13:16:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 4, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/how-do-i-exclude-the-log-directory-from-svn-repository/142199/1 "2008-07-04T13:16:59Z")

</div>

Every open source program comes with a vital instruction(s) that is  
(are) deliberately left out of the documentation so as to differentiate  
the pros from the newbies. In this case the svn documentation doesn’t  
tell you straight out how to exclude files, which means that if you  
blindly go ahead and import a standard rails directory structure you can  
end up with massive and entirely useless log files in your repository  
unless you do something about it.

After much hunting around the net, the documentation, the help lists  
I’ve discovered a little talked about, but totally crucial command, svn  
propset svn:ignore

which has the useful comment in the help screens  
svn:ignore - A newline separated list of file patterns to ignore.

Now that clearly tells everything a pro needs, but for a newbie like me  
leaving out the issue of how to put a newline into a list of file  
patterns when you’re typing from the command line renders the  
instruction useless. Yes I admit it, I’m a total newbie I can’t put a  
newline into a command line string without hitting the Enter key. Please  
can someone tell me how to do it. I guess I could create a file of file  
patterns I want ignored and pipe that in, but it seems a bit excessive.

I’m asking it here because it has to be a problem that everyone using  
rails and svn must have run into. There’s virtually nothing about it  
elsewhere.

Thanks

John S.

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 4, 2008, 3:31pm UTC](https://www.ruby-forum.com/t/how-do-i-exclude-the-log-directory-from-svn-repository/142199/2 "2008-07-04T15:31:24Z")

</div>

You want to keep the log directory, because rails needs it to run.  
What you want to do is ignore any files in the log directory.

Your project must already be tracked by svn in order to ignore files.  
Assuming it is, first, remove any files in the log directory and  
commit.

$ svn rm log/\*  
$ svn ci -m “removing log files”

Second, ignore any files in the log directory and commit.

$ svn propset svn:ignore “\*” log/  
$ svn ci -m “ignoring log files”

If you ever need to edit an svn property with multiple entries, look  
up svn:propedit and the SVN\_EDITOR environment variable, which is just  
one means of telling svn what text editor to invoke when you run  
svn:propedit (and other commands).

Now, if your project is not yet tracked by svn, then remove any files  
in the log directory, import the project, set svn:ignore on the log  
directory as we did earlier and commit.

By the way, the reason that I like to include the empty log directory  
in svn is so that other developers can just checkout the code and get  
to work; there’s no little step of remembering to create the log dir.  
I used to do the same for the tmp dir as I described for the log dir,  
but Rails 2.1 creates the tmp dir if doesn’t already exist.

Regards,  
Craig

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 5, 2008, 1:22pm UTC](https://www.ruby-forum.com/t/how-do-i-exclude-the-log-directory-from-svn-repository/142199/3 "2008-07-05T13:22:32Z")

</div>

Craig

I would rather use a more restricted pattern.

$ svn propset svn:ignore “\*.log” log/

I want ‘svn st’ to let me know if something different than a log  
file exists in the log/ folder

–  
Aníbal Rojas

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

[http://anibal.rojas.com.ve](http://anibal.rojas.com.ve)

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [July 4, 2008, 4:03pm UTC](https://www.ruby-forum.com/t/how-do-i-exclude-the-log-directory-from-svn-repository/142199/4 "2008-07-04T16:03:17Z")

</div>

Craig

Thanks for that.

I also found a neat little rake task at  
[http://snippets.dzone.com/posts/show/2925](http://snippets.dzone.com/posts/show/2925) which sets things up for  
Rails. The comments after that posting indicate that it should work  
wonderfully. Though of course it doesn’t. I have to sort out what’s  
going on with my svn to get it to work. There’s always little tricks and  
tweaks required.

Thanks

John S.
