changed directory.rb print names using while loop