Sha256: 222e337926ba02d1447a4c7a9a149e21460da3aecaf3564613e4277bd9997638
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
# this code is to list the links def fillhypergutenbergname(inffile) @a_newfilegutenberg = inffile end def findgutenbergfiles(d) a = Array.new(Dir[d].entries.sort) #loop through and get the files names a.each do |x| #adjust the filters to the files you want to see... if(!test(?d,x)) # only lnk files if x =~ /rb|txt|lst/ # puts "#{x}" $gutenbergarray = $gutenbergarray | ["#{x}"] end end end end def rwdgutenbergfiles $gutenbergarray = [""] startlangdir = @a_searchdirectorygutenberg puts startlangdir #get a list of the files and subdirectories on the starting directory only agutenbergarray = Array.new(Dir[startlangdir].entries.sort) p agutenbergarray #loop through the list, ignore the files and add all new directories found agutenbergarray.each do |x| #if a directory... if(test(?d,x)) # add to the original list of directories @@tmproot = x + "/**" puts @@tmproot #adds the new ones to the array bgutenbergarray = Dir[@@tmproot].entries.sort p bgutenbergarray bgutenbergarray.each do |x| p x if(test(?d,x)) agutenbergarray.push(x) #appends to the end of the array... p agutenbergarray end end end end agutenbergarray.each do |x| #if it is a file... if(!test(?d,x)) agutenbergarray.delete(x) else #it is a directory... findgutenbergfiles(x + "/**") end end @textsfilesrecordsresult = $gutenbergarray.rwd_method("fillhypergutenbergname") end
Version data entries
3 entries across 3 versions & 1 rubygems