Skip to content

Instantly share code, notes, and snippets.

@davidpdrsn
Created November 19, 2013 12:09
Show Gist options
  • Save davidpdrsn/7544437 to your computer and use it in GitHub Desktop.
Save davidpdrsn/7544437 to your computer and use it in GitHub Desktop.
Move Java files into folders
Dir.glob("*.java").each do |f|
contents = File.read f
folder = contents.
split("\n").
first.
delete("/").
delete(" ").
delete(",test").
delete(",implementation").
gsub(".","_").
gsub("P","P_")
system "mkdir -p #{folder}"
system "mv #{f} #{folder}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment