Created
October 4, 2012 05:22
-
-
Save mweppler/3831623 to your computer and use it in GitHub Desktop.
Move files sorted by video/source into same directory
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'fileutils' | |
Dir.glob('/Volumes/Share/Media/Videos/Software\ Training/video/*').each do |file| | |
fn = File.basename file, File.extname(file) | |
sd = File.dirname(file) + '/../' + 'source/' | |
sf = sd + fn + '.zip' | |
nd = File.dirname(file) + '/../' + fn | |
(File.exists? nd) ? next : Dir.mkdir(nd) | |
FileUtils.mv file, nd | |
FileUtils.mv sf, nd if File.exists? sf | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment