From: an an Date: 2008-02-09T07:45:57+09:00 Subject: Re: trouble with FileUtils.rm() -- Invalid arguement error Tim Hunter wrote: > an an wrote: >> >> I have tried several different variations, of backtick, single quotes, >> double quotes, etc, etc....even tried deleting a single file, and it >> always gives me the same error. Also tried rm_r, rm_rf...still no luck. >> >> could someone explain to me what I am doing wrong? thanks! > > It looks like you're trying to remove all the files in the directory at > once. Bear in mind that FileUtils.rm wants a _list_ of filenames, not a > pattern to match. You can specify a list of filenames by accumulating > them in an array and then using the splat operator: > > filenames = whatever it takes to get all the filename in an array > FileUtils.rm(*filenames) So I am stuck again on this...I have the following code: dir = Dir.open("c:\\myDir\\delete\\") FileUtils.rm(dir.entries.reject{|e| /\.{1,2}$/ =~ e}) the problem is, that the dir.entries only returns the filename of each entry...is there anyway to have them expanded? -- Posted via http://www.ruby-forum.com/.