From: Clement Ow Date: 2008-04-17T11:53:23+09:00 Subject: Deleting of files older than a stipulated date Pardon for my multiple posts in this forum as Im rushing a project but still quite new in ruby.. Anyway, I would like to select files to delete based on their datestamped folders. For example, I would like to delete files which older than 5 business days (i.e that means you dont count sats and suns). Currently my code looks like this: def delFiles sd_a=$del_path.zip($del_selection) sd_a.each do |sd| $del_path, $del_selection = sd del = File.join $del_path, $del_selection puts "Files/Folders Deleted: #{del}" FileUtils.rm_r Dir.glob(del) end #each end #delFiles Im actually using arrays to contain my del_path and del_selection because I will need to delete multiple directories or files all at once. Is there any way where I can build on my code but with the criteria that only files older than 5 business days (bearing in mind that files not only contain the date eg. 20080331 but can also come with other characters eg. risk20080331) get deleted. Much help is really appreciated. ;) -- Posted via http://www.ruby-forum.com/.