From: Peter Bailey Date: 2013-01-10T20:58:33+09:00 Subject: Re: One liner for filenames Brian D. B. wrote in post #1091712: > On 01/08/2013 05:04 PM, Damián M. González wrote: >>> ... >> ruby -e "Dir.foreach('C:/Directory_with_png/') {|file| File.delete(file) >> unless (file.==('.')) || (file.==('..') || (file.==('filename_1.png'))" >> >> Kind regards. >> > > There's certainly many ways to do this, but globing will ignore the dot > dirs, and is a bit shorter. > File.delete *Dir['*.png'].reject {|f| f =~ /_1\.png$/ } Thanks, Brian. But, even preceding this with "ruby -e" gives me nothing. Should I make this part of a script instead of it being a one-liner? -- Posted via http://www.ruby-forum.com/.