Created
August 14, 2013 02:42
-
-
Save yoni/6227583 to your computer and use it in GitHub Desktop.
Converts R filenames from camel case to snake case.
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
#!/usr/bin/env ruby -n | |
name = $_ | |
if name != name.upcase | |
puts "mv #{name.chomp} #{name.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase.gsub('.r', '.R').gsub('r/','R/')}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment