From: Jeremy Bopp Date: 2010-10-05T21:52:27+09:00 Subject: Re: how do i delete files in particular directoryin ruby ??? On 10/05/2010 07:31 AM, Amit Tomar wrote: > Jeremy Bopp wrote: >> On 10/05/2010 04:11 AM, Amit Tomar wrote: >>>> >>>> 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 > > Thanks jeremy ... > but am on windows side and can i delete those files also that are in use > means when am trying to manually delete particular file(mongrel temp > file)am getting error message can't delete files its in use > but usinf -rf can i delete those files also?? You're bumping into a common limitation of Windows, sadly. It takes some special tricks to fake deleting a file which is in use on Windows, and I'm not certain that FileUtils has been written to perform such tricks. Note that I did say "fake deleting" since the file is not really deleted until it is no longer in use. It's just cleverly moved and hidden from what I understand. Cygwin and the Cygwin build of Ruby should be able to do this for you, but you are doing something which is not normal for Windows. Why do you want to delete this temporary file while Mongrel is running in the first place? -Jeremy