today = (Time.now - 24 * 60 * 60 * 30).strftime("%Y%m%d") Dir.glob("file.*.tar.bz2"){|f| next unless f =~ /file\.(.*?)\.tar\.bz2/ if $1 < today puts "delete #{f} ..." `rm #{f}` end }
today = (Time.now - 24 * 60 * 60 * 30).strftime("%Y%m%d") Dir.glob("file.*.tar.bz2"){|f| next unless f =~ /file\.(.*?)\.tar\.bz2/ if $1 < today puts "delete #{f} ..." `rm #{f}` end }