How can I delete a file?

1,763 views
Skip to first unread message

John Smith

unread,
Jan 11, 2009, 1:48:55 PM1/11/09
to rubyonra...@googlegroups.com
I want to delete a file that is in
public/system/photos/original/1/photo.jpg. How can I delete it?
--
Posted via http://www.ruby-forum.com/.

John Yerhot

unread,
Jan 11, 2009, 6:14:33 PM1/11/09
to Ruby on Rails: Talk
Check out the File class.
http://www.ruby-doc.org/core/classes/File.html#M002559

File.delete("#{RAILS_ROOT}/public/system/photos/original/1/photo.jpg")

That should do it.

-John

On Jan 11, 12:48 pm, John Smith <rails-mailing-l...@andreas-s.net>
wrote:

John Smith

unread,
Jan 12, 2009, 3:02:36 AM1/12/09
to rubyonra...@googlegroups.com
John Yerhot wrote:
> Check out the File class.
> http://www.ruby-doc.org/core/classes/File.html#M002559
>
> File.delete("#{RAILS_ROOT}/public/system/photos/original/1/photo.jpg")
>
> That should do it.
>
> -John
>
> On Jan 11, 12:48�pm, John Smith <rails-mailing-l...@andreas-s.net>

Thanks a lot! I will try iy.

Reply all
Reply to author
Forward
0 new messages