# Create folder ok delete not

**URL:** <https://www.ruby-forum.com/t/create-folder-ok-delete-not/75528>\
**Category:** Ruby\
**Created:** [March 1, 2006, 11:33pm UTC](https://www.ruby-forum.com/t/create-folder-ok-delete-not/75528 "2006-03-01T23:33:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [March 1, 2006, 11:33pm UTC](https://www.ruby-forum.com/t/create-folder-ok-delete-not/75528/1 "2006-03-01T23:33:42Z")

</div>

it works

public\_dir = File.join(RAILS\_ROOT, “public/images”)  
dir = File.join( public\_dir, “#{new\_property.id}”)  
FileUtils.mkpath(dir) unless File.exists?(dir)

it not

public\_dir = File.join(RAILS\_ROOT, “public/images”)  
folder = “118”  
dir = File.join( public\_dir, “#{folder}”)  
File.unlink(dir)

its not the same ?

I got error

Is a directory -  
/home/maugustyniak/workspace/new\_bjbpartners/public/…/config/…/public/images/118

---

<div class="post-metadata">

**Author:** ![misiek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@misiek](https://www.ruby-forum.com/u/misiek)\
**Post date:** [March 1, 2006, 11:38pm UTC](https://www.ruby-forum.com/t/create-folder-ok-delete-not/75528/2 "2006-03-01T23:38:40Z")

</div>

sorry never mind its so stupid I think I am tired  
dir.delete of course
