Skip to content

Instantly share code, notes, and snippets.

@cjweeg
cjweeg / "BagIt" error finder
Created December 20, 2011 20:31
Looks through a "BagIt" Missing-Files-manifest and locates lines where the string "._" does not occur
#!/usr/bin/env ruby
# ARGV[0] should point to the directory where the "BagIt" text file is stored
if !ARGV[0]
puts "You must specify the directory \"BagIt\" text file is stored. Try again!"
exit
end
# first we find the full path of the argument in case we're only given
#!/usr/bin/env ruby
# ARGV[0] should point to the "Raw" directory
# ARGV[1] should point to the "Enhanced" directory
if !ARGV[0] or !ARGV[1]
puts "You must specify the raw and enhanced directories. Try again!"
exit
end
#!/usr/bin/env ruby
raw_input_file_path = ARGV[0]
enhanced_input_file_path = ARGV[1]
enhanced_file_path = Dir.glob(raw_input_file_path)
raw_file_path = Dir.glob(enhanced_input_file_path)
enhanced_files = enhanced_file_path.map {|x| File.basename(x)}
ie = Dir.glob('/Users/scmac/Desktop/ChrisWeeg/ruby/identical/Enhanced/*')
ir = Dir.glob('/Users/scmac/Desktop/ChrisWeeg/ruby/identical/Raw/*')
junk = "abcdefghijklmnopqrstuvwxyzABCDEFGHILKLMNOPQRSTUVWXYZ"
ie.each {|x| x.delete! junk}
ir.each {|x| x.delete! junk}
ie.each {|x| x.delete! "/"}
ir.each {|x| x.delete! "/"}