Advertisement
Guest User

Untitled

a guest
May 24th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. # Takes a NEO import and converts it into more readable files and filenames
  4.  
  5. require 'fileutils'
  6.  
  7. (1..8).to_a.each do |filenum|
  8. filename = "File #0#{filenum}.txt"
  9. if File.exist?(filename)
  10. FileUtils.cp filename, "#{filenum}.txt"
  11. end
  12. end
  13.  
  14. (1..8).to_a.each do |filenum|
  15. filename = "#{filenum}.txt"
  16. if File.exist?(filename)
  17. lines = File.read(filename).split(/\r/)
  18. File.open(filename, 'w') do |f|
  19. f.puts lines.join("\n")
  20. end
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement