Forum: Ruby on Rails How can I delete a file?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
71e53b54803415f87ef1b898baf8f3ca?d=identicon&s=25 John Smith (terry_wolf)
on 2009-01-11 19:48
I want to delete a file that is in
public/system/photos/original/1/photo.jpg. How can I delete it?
00e8233b7817ac14040f7928e6d4b889?d=identicon&s=25 John Yerhot (Guest)
on 2009-01-12 00:15
(Received via mailing list)
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>
71e53b54803415f87ef1b898baf8f3ca?d=identicon&s=25 John Smith (terry_wolf)
on 2009-01-12 09:02
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.
This topic is locked and can not be replied to.