Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Move files sorted by video/source into same directory
#!/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
You can’t perform that action at this time.