From: Jeremy Bopp Date: 2010-10-05T21:10:18+09:00 Subject: Re: how do i delete files in particular directoryin ruby ??? On 10/05/2010 04:11 AM, Amit Tomar wrote: > Robert Klemme wrote: >> On Mon, Oct 4, 2010 at 2:27 PM, Stefano Crocco >> wrote: >>> >>> FileUtils.rm Dir.glob('/path/to/dir/*') >>> ?FileUtils.rm f unless File.directory? f >>> >>> I hope this helps >> >> And then there is also FileUtils.rm_r and FileUtils.rm_rf. :-) >> >> Cheers >> >> > Thanks Robert > but what is FileUtils.rm_r and FileUtils.rm_rf for?? FileUtils.rm emulates the function of the Unix rm program. FileUtils.rm_r and FileUtils.rm_rf emulate that program when using the -r and -rf options respectively. The -r option (or _r) tells rm to work recursively, to delete any subdirectories and their contents as well as files in the selected directory. The -rf option (or _rf) is also recursive but it adds a force option that will allow rm to delete files that you own but which have been marked read-only. Take special care with that one! -Jeremy