# How to ignore a folder with svn and capistrano

**URL:** <https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363>\
**Category:** Deployment\
**Created:** [February 12, 2007, 11:55pm UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363 "2007-02-12T23:55:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vixiom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vixiom](https://www.ruby-forum.com/u/vixiom)\
**Post date:** [February 12, 2007, 11:55pm UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363/1 "2007-02-12T23:55:28Z")

</div>

Hi

I have a site with an uploads folder ‘public/uploads’ and whenever I  
deploy previous uploads disappear. I figure it’s one of two things svn  
is deleting them (but it’s supposed to leave files it doesn’t know  
about alone) or the uploads are getting left behind in the old  
release.

Any ideas on what could be going wrong? How can I set the folder to be  
ignored or the files moved to the new release?

thanks!

---

<div class="post-metadata">

**Author:** ![vixiom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vixiom](https://www.ruby-forum.com/u/vixiom)\
**Post date:** [February 13, 2007, 12:08am UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363/2 "2007-02-13T00:08:31Z")

</div>

> I have a site with an uploads folder ‘public/uploads’ and whenever I  
> deploy previous uploads disappear. I figure it’s one of two things svn  
> is deleting them (but it’s supposed to leave files it doesn’t know  
> about alone) or the uploads are getting left behind in the old  
> release.
> 
> Any ideas on what could be going wrong? How can I set the folder to be  
> ignored or the files moved to the new release?

Your best bet is to create a symlink from ‘public/uploads’ to the  
‘shared’  
directory. That is…

current/public/uploads -\> shared/public/uploads

Then modify the capistrano task to make sure that symlink is there after  
a  
deploy.

Something like this:

task :after\_update\_code, :roles =\> :app do  
run “ln -nfs ‘#{shared\_path}/public/uploads’  
‘#{release\_path}/public/uploads’”  
end

-philip

---

<div class="post-metadata">

**Author:** ![vixiom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vixiom](https://www.ruby-forum.com/u/vixiom)\
**Post date:** [February 13, 2007, 12:10am UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363/3 "2007-02-13T00:10:33Z")

</div>

Your uploads are probably being left in the old release. You should  
move them to a shared folder and symlink to them from your release  
directory. Something like this in your deploy recipe should work:

task :after\_update\_code, :roles =\> :app do  
run “ln -sf #{deploy\_to}/shared/uploads #{release\_path}/public/  
uploads”  
end

---

<div class="post-metadata">

**Author:** ![vixiom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vixiom](https://www.ruby-forum.com/u/vixiom)\
**Post date:** [February 23, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363/4 "2007-02-23T20:13:28Z")

</div>

I successfully created the symlink from public/uploads to  
shared/uploads, but my images don’t appear when I browse the site. My  
image src tags are correct, but the symlink doesn’t resolve. Any ideas?

Thx  
Greg

---

<div class="post-metadata">

**Author:** ![vixiom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vixiom](https://www.ruby-forum.com/u/vixiom)\
**Post date:** [February 13, 2007, 8:18am UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363/5 "2007-02-13T08:18:21Z")

</div>

On Feb 12, 2:54 pm, “Vixiom” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have a site with an uploads folder ‘public/uploads’ and whenever I  
> deploy previous uploads disappear. I figure it’s one of two things svn  
> is deleting them (but it’s supposed to leave files it doesn’t know  
> about alone) or the uploads are getting left behind in the old  
> release.

The previous posters are correct that your uploads are being left in  
the old release.

I prefer, and encourage my customers, to symlink public/uploads to  
public/system/uploads. public/system is created by Capistrano on  
every deploy and points to RAILS\_ROOT/…/shared/system, so the  
symlink above will place photos in shared/system/uploads.

symlinks can be added to Subversion. 🙂

You’ll likely want to set svn:ignore to ‘system’ in Subversion as  
well, as you’ll need a public/system on your development system  
to exist, but you should _not_ add the system directory to your  
repository.

–  
– Tom M., CTO  
– Engine Y.

---

<div class="post-metadata">

**Author:** ![vixiom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vixiom](https://www.ruby-forum.com/u/vixiom)\
**Post date:** [February 23, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/how-to-ignore-a-folder-with-svn-and-capistrano/85363/6 "2007-02-23T20:48:18Z")

</div>

Greg wrote:

> I successfully created the symlink from public/uploads to  
> shared/uploads, but my images don’t appear when I browse the site. My  
> image src tags are correct, but the symlink doesn’t resolve. Any ideas?
> 
> Thx  
> Greg

Nevermind, got it. Just a corrupt symlink.
