I have the following code:
Dir.chdir(mydir)
Dir.entries(mydir).each do |file|
log.info(file)
end
My problem is that Dir.entries does not appear to “see” the three most recently created files in the directory; that is, they don’t show up in the log. I’m using Ruby 1.9.2 on Windows XP. The files were created immediately before the above code, via a StatTransfer command file:
# Run the stcmd file and wait for it to finish
threadC = Thread.new {system("ST \"myStatTransferProgram.stcmd\"")}
threadC.join
I don’t think that StatTransfer is the problem, because Dir.entries can “see” the first few files produced by the stcmd file just fine. I tried adding in sleep(30) between the two steps in case Thread.join doesn’t do what I think it does, but that didn’t make a difference. I am new to Ruby and would appreciate any suggestions– thank you!
I’m not entirely sure what was going on, but it seems that the problem was related to a File.rename in an earlier step, not to the step I thought it was related to. I’m sorry for leading people down the wrong path. If anyone wants more info, just let me know.