Skip to content

Instantly share code, notes, and snippets.

@drhuffman12
Last active January 27, 2017 23:49
Show Gist options
  • Save drhuffman12/1428a9ce6a8ec729287d7d8daa6db59c to your computer and use it in GitHub Desktop.
Save drhuffman12/1428a9ce6a8ec729287d7d8daa6db59c to your computer and use it in GitHub Desktop.
Replace all "\r\n" occurances with "\n" for all files in a folder
@folder_path = 'path/to/your/folder'
Dir.glob(File.join(@folder_path,'*')).each {|f| File.open(f, 'w', crlf_newline: false) {|f| f.write(File.read(f).gsub("\r\n","\n") } };nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment