From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-10-20T19:55:16+09:00 Subject: Re: Removing files if those exists Simo M. wrote: > If file junk*.cs exist > - remove all junk*.cs files from dir Here it is : ---------------------------- #! /opt/local/bin/ruby1.9 # encoding: utf-8 TRASH="#{ENV['HOME']}/.Trash" #might be specific to Mac OS X Dir.glob("test/junk*.cs").each {|file| File.rename(file, "#{TRASH}/#{File.basename(file)}")} ---------------------------- instead if u don't want to trash, just remove : ---------------------------- #! /opt/local/bin/ruby1.9 # encoding: utf-8 require 'rubygems' require 'fileutils' Dir.glob("test/junk*.cs").each {|file| FileUtils.rm_rf file} ---------------------------- -- � Le meilleur moyen de tenir sa parole est de ne jamais la donner. � (Napol�on Bonaparte)