Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created October 17, 2014 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashaw/af3e7b3f914ddeddffc8 to your computer and use it in GitHub Desktop.
Save ashaw/af3e7b3f914ddeddffc8 to your computer and use it in GitHub Desktop.
color = Dir["./hermitage\ color/*"]
infra = Dir["./hermitage\ infra/*"]
start_color = 213
start_infra = 297
color_idx = 0
infra_idx = 0
def mk_filename(idx)
prefix = "IMG_"
no_str = idx < 1000 ? "0#{idx}" : idx
"#{prefix}#{no_str}"
end
def parse_filename(f)
File.basename(f).gsub(/[^\d]/,"").to_i
end
color.each do |c|
if parse_filename(c) >= start_color
p "moving #{c} to ./hermitage_sync/#{color_idx}_color.jpg"
`mv "#{c}" ./hermitage_sync/#{color_idx}_color.jpg`
color_idx += 1
end
end
infra.each do |c|
if parse_filename(c) >= start_infra
p "moving #{c} to ./hermitage_sync/#{infra_idx}_infra.jpg"
`mv "#{c}" ./hermitage_sync/#{infra_idx}_infra.jpg`
infra_idx += 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment