From: Stefano Crocco Date: 2010-10-04T22:35:31+09:00 Subject: Re: how do i delete files in particular directoryin ruby ??? On Monday 04 October 2010, Amit Tomar wrote: > |Stefano Crocco wrote: > |> On Monday 04 October 2010, Amit Tomar wrote: > |>> |dir ="C:/Documents and Settings/x0100039/Local Settings/Temp" > |>> | > |>> | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:1297:in > |>> | > |>> |`each' > |>> | > |>> | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:548:in > |>> | > |>> |`rm' > |>> | > |>> | from ruby2.rb:8 > |>> | from ruby2.rb:5:in `each' > |>> | from ruby2.rb:5 > |> > |> Have you tried removing one of those files by hand? If that works, then > |> we now > |> the issue is with ruby. If it doesn't, you may get a clearer error > |> message > |> and, at least, we'll know the issue is not with your code. > |> > |> Stefano > | > |Stefano what you want to say is if we are not able to delete with hand > |,we can cann't do it with code?????? What I mean is that if you launch the file manager (clicking on the "My Computer" icon, for example), navigate to the directory where your files are, select one of them, press the Delete button on your keyboard and you get an error message saying you can't delete the file (hopefully with an explaination of why you can't delete it) then, of course, you also won't be able to delete it from ruby. If windows thinks a file can't be deleted (or at least it can be deleted only from the system administrator, for example), then it won't allow you to delete it, and it doesn't matter whether you're using the file manager, ruby or some other program to delete the file: they all have to use the same functionality provided by windows to do so. Stefano