Skip to content

Instantly share code, notes, and snippets.

@rococodogs
Created November 11, 2013 05:08
Show Gist options
  • Save rococodogs/7408209 to your computer and use it in GitHub Desktop.
Save rococodogs/7408209 to your computer and use it in GitHub Desktop.
parsing through library course guides directory to compile list of items
class LittleGeek
require "find"
attr_accessor :dir
def initialize(dir = Dir.getwd)
# the current working directory will be the default directory
@dir = dir
end
def report
Find.find(@dir) do |path|
if File.directory?(path)
if path =~ /_bak|_notes|\./ #we'll skip these directories
Find.prune
else
puts "\n"
next
end
else
# it might be nice to put this in a cleaner form
#puts path + "\t" + File.mtime(path).strftime("%Y/%m/%d") unless path =~ /\.DS_Store|\.gif|\.png|\.jpg|\.jpeg/
puts "http://www.muhlenberg.edu/library/guides/" + path + "\t" + File.mtime(path).strftime("%Y/%m/%d") if path =~ /\.htm*/
end
end
end
end
require "./littlegeek.rb"
lg = LittleGeek.new("libinst")
lg.report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment