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