From: Stefano Crocco Date: 2010-10-04T21:51:33+09:00 Subject: Re: how do i delete files in particular directoryin ruby ??? On Monday 04 October 2010, Amit Tomar wrote: > |Thanks for your help Stefano > |but when i trying to delete files in particular direcotry , am getting > |permission denied ,this is how am trying to delete files > | > |require 'fileutils' > | > |dir ="C:/DOCUME~1/x0100039/LOCALS~1/Temp" > |Dir.chdir(dir) > |Dir.glob('*.*').each do|f| > | #puts f > | > | FileUtils.rm(f) > | #f.unlink > |# f.delete('*.tmp') > | > | end > | > |am trying to change the permission also but didn't work for me Your code seems correct. Since I don't use windows, I can't help you much there. Seeing your commented out puts makes clear you already checked the file names were correct (I'd also try with p rather than puts, to see the raw string, just in case). Does the error happen for all files, or just for some of them? Also, when you say you tried changing permissions, did you try only on the files or also on the directory itself (provided that directories can have permissions on windows. It's been some years since I last made serious use of windows, so I don't remember)? Stefano