Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created October 17, 2014 04:00
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/3dc6d64545c7617134c8 to your computer and use it in GitHub Desktop.
Save ashaw/3dc6d64545c7617134c8 to your computer and use it in GitHub Desktop.
color = Dir["./west bay pass 1 color/*"]
infra = Dir["./west bay pass 1 infra/*"]
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
def orig_basename(f)
File.basename(f).gsub(/\.JPG/,"")
end
color.each do |c|
p "moving #{c} to ./wb1sync/#{color_idx}_color.jpg"
`mv "#{c}" ./wb1sync/#{color_idx}_color_#{orig_basename(c)}.jpg`
color_idx += 1
end
infra.each do |c|
p "moving #{c} to ./wb1sync/#{infra_idx}_infra.jpg"
`mv "#{c}" ./wb1sync/#{infra_idx}_infra_#{orig_basename(c)}.jpg`
infra_idx += 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment