From: Stefano Crocco Date: 2010-10-04T22:06:03+09:00 Subject: Re: how do i delete files in particular directoryin ruby ??? On Monday 04 October 2010, Amit Tomar wrote: > |Steel Steel wrote: > |> Amit Tomar wrote: > |>> dir ="C:/DOCUME~1/x0100039/LOCALS~1/Temp" > |> > |> Try using the full path (without ~) > | > |Thanks steel i tried with full name but still getting problem > | > |require 'fileutils' > | > |dir ="C:/Documents and Settings/x0100039/Local Settings/Temp" > |Dir.chdir(dir) > |Dir.glob('*').each do|f| > | > | FileUtils.rm(f) > | > | > | end > |but am getting these error: > |C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:1297:in `unlink': > |Permission denied - CGI.3408.1 (Errno::EACCES) > | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:1297:in > |`remove_file' > | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:1305:in > |`platform_support' > | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:1296:in > |`remove_file' > | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:771:in > |`remove_file' > | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:549:in > |`rm' > | from C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/fileutils.rb:548: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