--8323328-1137606729-10960627182609 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1137606729-1096062718=:12609" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1137606729-10960627182609 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 25 Sep 2004, STEPHEN BECKER I V wrote: > I am writing a program to go in all the folders, then in to there folders.... > > def dirsearch (coming_in) #declare coming_in is the directory to be searched > print "\n\n\n",coming_in," line 2 \n\n\n" #testing > Dir.chdir(coming_in) #change to the directory > mainloc = Dir.getwd #new base > file = Array.new > > print "\n\n\n",mainloc," line 7 \n\n\n" #testing > > loc = Dir.open(mainloc) #open the folder > loc.each {|x| file.push(x) } #get the folders and files > > dir = Array.new > count = file.size #amounts > > if count==0 then break end#check if there are any files > print "-----------list------------",count,"--" > while count>0 > if(!(file[count-1].include? ?.)) #for windows assume that file has an > extension and no folders have a . > reform = mainloc +'/'+ file[count-1] # create list of folders > print reform > dir.push(reform) > end > count-=1 > end > print "\n" > if !(dir.size==0) then #check if any folders to go in to > many = dir.size-1; > while many>0 > print dir[many],"loop at 28th\n" > if(!(dir[many].nil?))then #having a problem with nil folders? any help? > dirsearch(dir[many])#call function with new directory > end > many-=1 > end > end > end > > dirsearch("c:") # light the candle > > > i am using SciTE in windows XP. It just seems to be cutting out after > about 5 runs of the function. Am i writing over the same variables? > Becker this might be of help harp:~/eg/ruby > ruby -e 'p Dir["**/*"]' ["vsdb", "vsdb/vsdb-0.0.0", "vsdb/vsdb-0.0.0/ruby_vsdb.c", "vsdb/vsdb-0.0.0/mkmf.log", "vsdb/vsdb-0.0.0/extconf.rb", "vsdb/vsdb-0.0.0/Makefile", "vsdb/vsdb-0.0.0/ruby_vsdb.o", "vsdb/vsdb-0.0.0/vsdb.so", "vsdb/vsdb-0.0.0/vsdb", "vsdb/vsdb-0.0.0/vsdb/dbd.13", "vsdb/vsdb-0.0.0/vsdb/dbd.13/db.13", "vsdb/vsdb-0.0.0/vsdb/db.cache", "vsdb/vsdb-0.0.0/test.rb", "vsdb/vsdb-0.0.0/core.9780", "vsdb/vsdb-0.0.0/core.9781", "vsdb/vsdb-0.0.0/core.9791", "vsdb/vsdb-0.0.0/core.9823", "vsdb/vsdb-0.0.0/jib", "vsdb/vsdb-0.0.0/vsdb_test.rb",templates", "templates/main1.rb", "templates/inc.rb", "templates/class.rb", "templates/test.rb", "templates/main0.rb", "templates/out", "templates/foo", "templates/stp", "templates/stp/inc.rb", "templates/stp/class.rb", "templates/foo-0.0.0", "templates/foo-0.0.0/lib", "templates/foo-0.0.0/lib/foo-0.0.0", "templates/foo-0.0.0/lib/foo-0.0.0/bar.rb", "templates/foo-0.0.0/lib/foo-0.0.0.rb", "templates/lib", "templates/lib/foo-0.0.0", "templates/lib/foo-0.0.0/bar.rb", "templates/lib/foo-0.0.0.rb", "templates/lib/foo.rb", "templates/main2.rb", "templates/install.rb", "templates/foobar", "templates/newclass", "templates/newinc", "templates/newmain", "templates/main4.rb",templates/main3.rb", "templates/main5.rb", "templates/doc", "templates/doc/created.rid", "templates/doc/rdoc-style.css", "templates/doc/files", "templates/doc/files/logging_rb.html", "templates/doc/classes", "templates/doc/classes/c.src", "templates/doc/classes/c.src/M000001.html", "templates/doc/classes/c.src/M000002.html", "templates/doc/classes/LogMethods.src", "templates/doc/classes/LogMethods.src/M000003.html", "templates/doc/classes/LogMethods.src/M000004.html", "templates/doc/classes/LogMethods.src/M000005.html", "templates/doc/classes/LogMethods.src/M000006.html", "templates/doc/classes/LogMethods.src/M000007.html", "templates/doc/classes/LogMethods.src/M000008.html", "templates/doc/classes/LogMethods.src/M000009.html", "templates/doc/classes/LogMethods.src/M000010.html", "templates/doc/classes/LogMethods.src/M000011.html", "templates/doc/classes/LogMethods.src/M000012.html", "templates/doc/classes/LogMethods.src/M000013.html", "templates/doc/classes/Logging.src", "templates/doc/classes/Logging.src/M000014.html", "templates/doc/classes/A.html", "templates/doc/classes/c.html", "templates/doc/classes/LoggerExt.html", "templates/doc/classes/LogMethods.html", "templates/doc/classes/Logging.html", "templates/doc/fr_file_index.html", "templates/doc/fr_class_index.html", "templates/doc/fr_method_index.html", "templates/doc/index.html", "templates/stdout", "templates/log", "templates/logging.rb", "templates/util.rb", "templates/quote.rb", "templates/log.20040613", "templates/log.0", "templates/log.1", "templates/=main5.rb.conf", "templates/main5.rb.conf", "rq-all", "rq-all/packages", "rq-all/packages/sqlite-ruby-1.3.1.tar.gz", "rq-all/packages/posixlock-0.0.1.tgz", "rq-all/packages/arrayfields-3.4.0.tgz", "rq-all/packages/lockfile-1.1.0.tgz", "rq-all/packages/sqlite-2.8.15.tar.gz", "rq-all/packages/ruby-1.8.1.tar.gz", "rq-all/packages/rq-0.1.5.tgz", "rq-all/install.sh", "rq-all/README", "rq-all.tgz"] check out the docs for Dir::[] cheers. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen =============================================================================== --8323328-1137606729-10960627182609-- --8323328-1137606729-10960627182609--