Last active
December 17, 2015 19:19
-
-
Save martinos/5659775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_file_created_at(base_dir, time_range) | |
Dir["#{base_dir}/**/*"].select { |f| File.file?(f) && time_range.cover?(File.ctime(f)) }.map{|f| [File.ctime(f), f]} | |
end | |
time_range = Time.new(2011,5,5)..Time.new(2011,5,12) | |
files = find_file_created_at('.', time_range);1 | |
require 'fileutils' | |
files.each do |time, file| | |
new_file = File.join('c:\\Users\\Madame YonKa\\nic_music\\', file) | |
dir = File.dirname(new_file) | |
FileUtils.mkdir_p(dir) | |
FileUtils.mv(file, new_file) | |
end;1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment