Created
November 11, 2013 05:08
-
-
Save rococodogs/7408209 to your computer and use it in GitHub Desktop.
parsing through library course guides directory to compile list of items
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
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 |
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
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