From: Peter Bailey Date: 2013-01-10T00:15:38+09:00 Subject: Re: One liner for filenames Kim Pedersen wrote in post #1091524: >> >> I need to basically delete all of the files except for the first one, >> the one with the "_1" suffix at the end. Can I do that wiith a >> one-liner? >> >> Thanks, >> Peter >> > > Hi, > > This should work > > ruby -e "Dir.glob('*_*.png')[1..-1].each { |fn| File.delete fn}" > > Best regards > Kim Kim, I'd like to ask you about [1..-1]. I've never seen that before. Is that what's selecting all the files except the first one? -Peter -- Posted via http://www.ruby-forum.com/.