Advertisement
KoBeWi

HW Resource Utility

Oct 25th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.55 KB | None | 0 0
  1. LOCATOR = "locator_#{File.basename(Dir.getwd)}"
  2.  
  3. puts "Run this script inside a directory with all the files you want to include."
  4. puts "Enter the URL for download:"
  5.  
  6. url = gets.chomp
  7.  
  8. files = Dir.entries(".") - [".", "..", File.basename($0), LOCATOR]
  9.  
  10. trash = []
  11. files.each do |f| if f.end_with?("R.png") and f2=files.find{|ff| ff==f.chomp("R.png")+"L.png"}
  12.     trash << f2
  13.     f.chomp!("R.png")
  14.   end
  15. end
  16. files.delete_if {|f| trash.include?(f)}
  17.  
  18. files.collect! {|f| f.chomp(".png")}
  19.  
  20. f = File.new(LOCATOR, "w")
  21. f.puts url
  22. f.puts files
  23.  
  24. f.close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement