Created
November 19, 2013 12:09
-
-
Save davidpdrsn/7544437 to your computer and use it in GitHub Desktop.
Move Java files into folders
This file contains 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
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