# Capistrano + symlink to a shared images directory

**URL:** <https://www.ruby-forum.com/t/capistrano-symlink-to-a-shared-images-directory/60479>\
**Category:** Rails\
**Created:** [May 14, 2006, 3:01pm UTC](https://www.ruby-forum.com/t/capistrano-symlink-to-a-shared-images-directory/60479 "2006-05-14T15:01:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damnpenguins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a88e57/32.png) [@damnpenguins](https://www.ruby-forum.com/u/damnpenguins)\
**Post date:** [May 14, 2006, 3:01pm UTC](https://www.ruby-forum.com/t/capistrano-symlink-to-a-shared-images-directory/60479/1 "2006-05-14T15:01:13Z")

</div>

Hi everyone,

I have deployed a rails tumblelog site via capistrano, but have run into  
a problem. What I am wanting to do is this: In my deployment script  
create symlinks from the public directory so that the images directory  
points to a shared images directory.

Reason being is I am adding an image upload to the site (not  
file\_column) and need to easily add the uploaded images and thumbs into  
a shared directory. Could someone please help me with the proper  
commands to map the public/images directory to the shared/images  
directory via the after\_symlink task in deploy.rb?

thanks!

---

<div class="post-metadata">

**Author:** ![damnpenguins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a88e57/32.png) [@damnpenguins](https://www.ruby-forum.com/u/damnpenguins)\
**Post date:** [May 14, 2006, 4:01pm UTC](https://www.ruby-forum.com/t/capistrano-symlink-to-a-shared-images-directory/60479/2 "2006-05-14T16:01:43Z")

</div>

On May 14, 2006, at 7:01 AM, Cameron S. wrote:

> into  
> a shared directory. Could someone please help me with the proper  
> commands to map the public/images directory to the shared/images  
> directory via the after\_symlink task in deploy.rb?

This ought to do it:

task :after\_symlink do  
run “ln -nfs #{shared\_dir}/images #{release\_dir}/public/images”  
end

- Jamis

---

<div class="post-metadata">

**Author:** ![damnpenguins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a88e57/32.png) [@damnpenguins](https://www.ruby-forum.com/u/damnpenguins)\
**Post date:** [May 15, 2006, 7:39am UTC](https://www.ruby-forum.com/t/capistrano-symlink-to-a-shared-images-directory/60479/3 "2006-05-15T07:39:51Z")

</div>

Jamis B. wrote:

> On May 14, 2006, at 7:01 AM, Cameron S. wrote:
> 
> > into  
> > a shared directory. Could someone please help me with the proper  
> > commands to map the public/images directory to the shared/images  
> > directory via the after\_symlink task in deploy.rb?
> 
> This ought to do it:
> 
> task :after\_symlink do  
> run “ln -nfs #{shared\_dir}/images #{release\_dir}/public/images”  
> end
> 
> - Jamis

Great! Thanks for that!
