From d137e78f19459e71f16e91c1881055c18d459e4e Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 16 Apr 2014 15:11:27 +0800 Subject: [PATCH] remove tmp file rake task/ --- lib/tasks/rubyzip.rake | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/tasks/rubyzip.rake b/lib/tasks/rubyzip.rake index b57d5ed55..349ced29b 100644 --- a/lib/tasks/rubyzip.rake +++ b/lib/tasks/rubyzip.rake @@ -1,12 +1,26 @@ desc "nyan ruby zip operation" task :zip do - puts "will building zip tmp files sweeper." + puts "input rake zip:clean_tmp will removed tmp/*.zip ." end namespace :zip do desc "ruby zip sweeper" - task :rubyzip_clean do - puts "ruby zip sweeping..." + task :clean_tmp do + unless File.exist?(Dir.pwd+"/tmp/archiveZip") + puts "tmp/archiveZip folder is not exist. " + next + end + + puts "ruby zip sweeping..." + Dir.chdir('tmp/archiveZip') do + Dir['*'].select do |file| + if file =~ /archive_\d+\.zip/ + File.delete(file) + puts "#{file} is deleted." + end + end + end + puts "ruby zip sweeping is done." end end